-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (68 loc) · 2.34 KB
/
Copy pathcompatibility.yml
File metadata and controls
71 lines (68 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Compatibility
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
paths:
- "schemas/**"
- "scripts/compatibility.mjs"
- "scripts/lib.mjs"
- "tests/compatibility.test.mjs"
- ".github/workflows/compatibility.yml"
permissions:
contents: read
jobs:
classify:
name: Classify schema compatibility
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out proposed contracts
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: candidate
fetch-depth: 0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22
cache: npm
cache-dependency-path: candidate/package-lock.json
- run: npm ci
working-directory: candidate
- name: Extract latest released contracts
shell: bash
working-directory: candidate
run: |
set -euo pipefail
latest="$(git tag --list "v[0-9]*.[0-9]*.[0-9]*" --sort=-version:refname | head -n 1)"
test -n "$latest"
mkdir -p ../baseline
git archive "$latest" schemas | tar -x -C ../baseline
- name: Classify changes
id: classify
shell: bash
env:
REVIEW_APPROVED: ${{ contains(github.event.pull_request.labels.*.name, 'compatibility-reviewed') }}
run: |
set +e
node candidate/scripts/compatibility.mjs \
--base baseline/schemas \
--head candidate/schemas \
--output candidate/compatibility-report.json
code=$?
{
echo "## Compatibility against latest release"
echo '```json'
cat candidate/compatibility-report.json
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
if [[ "$code" -eq 2 && "$REVIEW_APPROVED" == "true" ]]; then
echo "Compatibility review accepted through the compatibility-reviewed label." >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
exit "$code"
- name: Upload compatibility report
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: compatibility-report
path: candidate/compatibility-report.json