|
14 | 14 | steps: |
15 | 15 | - uses: actions/checkout@v4 |
16 | 16 | with: |
17 | | - fetch-depth: 0 # required for --auto-baseline to find the last Publish commit |
| 17 | + fetch-depth: 0 # required for build:api-published to find the last Publish commit |
18 | 18 |
|
19 | 19 | - uses: actions/setup-node@v4 |
20 | 20 | with: |
|
31 | 31 | - name: Build release baseline |
32 | 32 | run: yarn build:api-published |
33 | 33 |
|
34 | | - # Generate diff — compareAPIs.js requires absolute paths |
35 | 34 | - name: Generate diff |
36 | | - run: | |
37 | | - yarn compare:apis \ |
38 | | - --branch-api-dir=$GITHUB_WORKSPACE/dist/branch-api \ |
39 | | - --base-api-dir=$GITHUB_WORKSPACE/dist/base-api \ |
40 | | - --isCI > /tmp/diff-current.txt 2>&1 || true |
| 35 | + run: yarn compare:apis --isCI > /tmp/diff-current.txt 2>&1 || true |
41 | 36 |
|
42 | 37 | # Check out snapshots repo so we can read the previous diff and commit the new one |
43 | 38 | - uses: actions/checkout@v4 |
|
78 | 73 | python3 << 'PYEOF' |
79 | 74 | import json, os, urllib.request, subprocess |
80 | 75 |
|
| 76 | + required = ['SLACK_TSDIFF_CHROMATIC_BOT_TOKEN', 'SLACK_CHANNEL_ID', 'GITHUB_TOKEN', 'TODAY', 'SNAPSHOTS_REPO', 'GITHUB_WORKSPACE'] |
| 77 | + missing = [k for k in required if not os.environ.get(k)] |
| 78 | + if missing: |
| 79 | + raise SystemExit(f"Missing required environment variables: {', '.join(missing)}") |
| 80 | +
|
81 | 81 | today = os.environ['TODAY'] |
82 | 82 | channel = os.environ['SLACK_CHANNEL_ID'] |
83 | 83 | snapshots_repo = os.environ['SNAPSHOTS_REPO'] |
@@ -129,4 +129,6 @@ jobs: |
129 | 129 | ) |
130 | 130 | resp = json.loads(urllib.request.urlopen(req).read()) |
131 | 131 | print("Slack response:", resp.get('ok'), resp.get('error', '')) |
| 132 | + if not resp.get('ok'): |
| 133 | + raise SystemExit(f"Slack error: {resp.get('error')}") |
132 | 134 | PYEOF |
0 commit comments