Skip to content

Commit 67ea4b4

Browse files
justin808claude
andcommitted
Fix actionlint errors in workflow matrix conditionals
The previous approach using matrix.exclude with matrix context expressions caused actionlint errors because the matrix context is not available in the exclude section. **Fix:** - Move conditional logic to job-level if statements - Check both event type and dependency level in single expression - For regular PRs: only run latest versions - For master/workflow_dispatch: run all versions including minimum This properly filters matrix jobs without using unsupported contexts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 21e9f1a commit 67ea4b4

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

.github/workflows/examples.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ jobs:
3838

3939
examples:
4040
needs: detect-changes
41-
if: github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_generators == 'true'
41+
# For regular PRs: only run latest versions
42+
# For master/workflow_dispatch: run all versions
43+
if: |
44+
(github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_generators == 'true') &&
45+
(matrix.dependency-level != 'minimum' || github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch')
4246
strategy:
4347
fail-fast: false
4448
matrix:
@@ -49,9 +53,6 @@ jobs:
4953
# Master and workflow_dispatch: Minimum supported versions (full coverage)
5054
- ruby-version: '3.2'
5155
dependency-level: 'minimum'
52-
# On PRs (not workflow_dispatch), only run latest versions
53-
exclude:
54-
- ${{ github.event_name != 'workflow_dispatch' && github.ref != 'refs/heads/master' && matrix.dependency-level == 'minimum' || null }}
5556
env:
5657
SKIP_YARN_COREPACK_CHECK: 0
5758
BUNDLE_FROZEN: ${{ matrix.dependency-level == 'minimum' && 'false' || 'true' }}

.github/workflows/main.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ jobs:
3939
build-dummy-app-webpack-test-bundles:
4040
needs: detect-changes
4141
# Run on master, workflow_dispatch, OR when tests needed on PR
42+
# For regular PRs: only run latest versions
43+
# For master/workflow_dispatch: run all versions
4244
if: |
43-
(github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_dummy_tests == 'true')
45+
(github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_dummy_tests == 'true') &&
46+
(matrix.dependency-level != 'minimum' || github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch')
4447
strategy:
4548
matrix:
4649
include:
@@ -52,9 +55,6 @@ jobs:
5255
- ruby-version: '3.2'
5356
node-version: '20'
5457
dependency-level: 'minimum'
55-
# On PRs (not workflow_dispatch), only run latest versions
56-
exclude:
57-
- ${{ github.event_name != 'workflow_dispatch' && github.ref != 'refs/heads/master' && matrix.dependency-level == 'minimum' || null }}
5858
runs-on: ubuntu-22.04
5959
steps:
6060
- uses: actions/checkout@v4
@@ -126,8 +126,11 @@ jobs:
126126
dummy-app-integration-tests:
127127
needs: [detect-changes, build-dummy-app-webpack-test-bundles]
128128
# Run on master, workflow_dispatch, OR when tests needed on PR
129+
# For regular PRs: only run latest versions
130+
# For master/workflow_dispatch: run all versions
129131
if: |
130-
(github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_dummy_tests == 'true')
132+
(github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run_dummy_tests == 'true') &&
133+
(matrix.dependency-level != 'minimum' || github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch')
131134
strategy:
132135
fail-fast: false
133136
matrix:
@@ -140,9 +143,6 @@ jobs:
140143
- ruby-version: '3.2'
141144
node-version: '20'
142145
dependency-level: 'minimum'
143-
# On PRs (not workflow_dispatch), only run latest versions
144-
exclude:
145-
- ${{ github.event_name != 'workflow_dispatch' && github.ref != 'refs/heads/master' && matrix.dependency-level == 'minimum' || null }}
146146
runs-on: ubuntu-22.04
147147
steps:
148148
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)