Skip to content

Commit 7c5496b

Browse files
committed
ci(main): fix workflow
1 parent 4335319 commit 7c5496b

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

.github/workflows/main.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,29 @@ on:
1616
tags-ignore:
1717
- '**'
1818
jobs:
19+
checkExecution:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
shouldExecute: ${{ steps.stepCheckExecution.outputs.shouldExecute }}
23+
steps:
24+
- name: Dump GitHub context
25+
run: |
26+
echo "::group::github context"
27+
echo "$GITHUB_CONTEXT"
28+
echo "::endgroup::"
29+
env:
30+
GITHUB_CONTEXT: ${{ toJson(github) }}
31+
- id: stepCheckExecution
32+
name: Check for execution
33+
uses: shiftcode/github-action-skip@v4.0.0
34+
with:
35+
skipOnCommitMsg: '[skip_build]'
36+
githubToken: ${{ secrets.GITHUB_TOKEN }}
1937
test:
2038
runs-on: ubuntu-latest
39+
needs: checkExecution
40+
# only execute if not skipped by commit message
41+
if: needs.checkExecution.outputs.shouldExecute == 'true'
2142
strategy:
2243
matrix:
2344
# Test with Node.js 24 and v25
@@ -44,9 +65,10 @@ jobs:
4465
build:
4566
runs-on: ubuntu-latest
4667
permissions:
47-
contents: write
48-
packages: write
49-
needs: test
68+
contents: read
69+
needs: [checkExecution, test]
70+
# only execute if not skipped by commit message
71+
if: needs.checkExecution.outputs.shouldExecute == 'true'
5072
steps:
5173
# checkout branch
5274
- name: Checkout
@@ -84,3 +106,6 @@ jobs:
84106
npm run publish-libs
85107
env:
86108
GITHUB_CONTEXT: ${{ toJson(github) }}
109+
# necessary to commit on protected branch after merging
110+
# and to run actions after version-bump commit (otherwise we can't create rules for merging as no workflows run after GITHUB_TOKEN commits)
111+
GH_TOKEN: ${{ secrets.GH_TOKEN }}

0 commit comments

Comments
 (0)