|
40 | 40 | message: "Updating baton capabilities." |
41 | 41 | add: "baton_capabilities.json" |
42 | 42 |
|
| 43 | + # On PR: verify committed JSON matches binary output |
| 44 | + - name: Verify committed metadata is up to date |
| 45 | + id: metadata-check |
| 46 | + if: github.event_name == 'pull_request' |
| 47 | + continue-on-error: true |
| 48 | + run: | |
| 49 | + CAPS_STALE=false |
| 50 | + CONFIG_STALE=false |
| 51 | +
|
| 52 | + if ! git diff --quiet -- baton_capabilities.json 2>/dev/null; then |
| 53 | + CAPS_STALE=true |
| 54 | + echo "::warning::baton_capabilities.json differs from binary output" |
| 55 | + git diff -- baton_capabilities.json |
| 56 | + fi |
| 57 | +
|
| 58 | + if [ "$CAPS_STALE" = "true" ] || [ "$CONFIG_STALE" = "true" ]; then |
| 59 | + echo "" |
| 60 | + echo "::error::The committed baton_capabilities.json and/or config_schema.json are out of date." |
| 61 | + echo "::error::The connector binary generates different metadata than what's committed." |
| 62 | + echo "::error::Run './connector capabilities > baton_capabilities.json' and './connector config > config_schema.json' locally, then commit the updated files." |
| 63 | + echo "::error::Or use the fix-ci-checks skill to update automatically." |
| 64 | + echo "" |
| 65 | + echo "Capabilities stale: $CAPS_STALE" |
| 66 | + echo "Config stale: $CONFIG_STALE" |
| 67 | + exit 1 |
| 68 | + fi |
| 69 | +
|
| 70 | + echo "Committed metadata matches binary output." |
| 71 | +
|
43 | 72 | # On PR: verify docs reflect current metadata |
44 | 73 | - name: Verify docs match current metadata |
45 | | - if: github.event_name == 'pull_request' |
| 74 | + id: docs-check |
| 75 | + if: github.event_name == 'pull_request' && always() |
| 76 | + continue-on-error: true |
46 | 77 | run: | |
47 | 78 | CAPS_CHANGED=false |
48 | 79 | CONFIG_CHANGED=false |
@@ -78,3 +109,12 @@ jobs: |
78 | 109 | echo "Capabilities changed: $CAPS_CHANGED" |
79 | 110 | echo "Config changed: $CONFIG_CHANGED" |
80 | 111 | exit 1 |
| 112 | +
|
| 113 | + # Fail the job if either PR check failed |
| 114 | + - name: Enforce PR check results |
| 115 | + if: github.event_name == 'pull_request' && always() |
| 116 | + run: | |
| 117 | + if [ "${{ steps.metadata-check.outcome }}" = "failure" ] || [ "${{ steps.docs-check.outcome }}" = "failure" ]; then |
| 118 | + echo "One or more PR checks failed. See above for details." |
| 119 | + exit 1 |
| 120 | + fi |
0 commit comments