Skip to content

Commit 10acb04

Browse files
committed
ci: verify that the action.yml files are in sync
In mxschmitt#218, I added a convenient way to launch this Action in detached mode: `mxschmitt/action-tmate/detached@v3`. The way this is implemented is a copy/edited version of `action.yml` in the `detached/` subdirectory. This runs the danger of inadvertent divergences, as happened in mxschmitt#221 (which I caught in time and the contributor gracefully addressed). Let's add automation not only to update the file easily but also to cause a failure in the PR build with a helpful message suggesting how to fix the problem. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 3f6efa8 commit 10acb04

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.github/workflows/checkin.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ jobs:
1313
uses: actions/setup-node@v3
1414
with:
1515
node-version: 20
16+
- name: Verify that action.yml files are in sync
17+
run: |
18+
npm run update-detached-action.yml &&
19+
if ! git diff --exit-code \*action.yml
20+
then
21+
echo '::error::action.yml files are not in sync, maybe run `npm run update-detached-action.yml`?'
22+
exit 1
23+
fi
1624
- name: Install dependencies
1725
run: npm ci
1826
- name: Run tests

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"scripts": {
88
"start": "node src/index.js",
99
"build": "ncc build src/main.js -o lib",
10+
"update-detached-action.yml": "sed '/^runs:$/{N;N;N;s/lib\\//..\\/&/g;};/^ detached:/{N;N;N;s/\\(default: .\\)false/\\1true/g;}' action.yml >detached/action.yml",
1011
"test": "GITHUB_EVENT_PATH= jest"
1112
},
1213
"repository": {

0 commit comments

Comments
 (0)