Skip paths-filter on workflow_dispatch to avoid missing-'before' warning

On workflow_dispatch there is no 'before' field in the event payload, so
dorny/paths-filter cannot compute a meaningful diff and warns, falling back
to a last-commit-only diff. A manual dispatch is an explicit request to build,
so skip the filter step on that event and force the 'changes' job's should_run
output to true. push/PR events are unchanged and still gated by the filter's
'code' output. This also keeps the changes job in agreement with the build
job's if-condition, which already forces the build on workflow_dispatch.

Assisted-By: Claude Opus 4.8
This commit is contained in:
Axel Uhl committed 2026-09-01 11:10:05 +02:00
1 parent a4450f1861
commit e024fca545
1 file changed
+8 -1
+8 -1
View File
@@ -64,10 +64,17 @@ jobs:
permissions: {}
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.filter.outputs.code }}
# On workflow_dispatch there is no 'before' field in the event payload, so
# paths-filter cannot compute a meaningful diff (it would warn and fall back
# to the last commit only). A manual dispatch is an explicit request to build,
# so we skip the filter step entirely and force should_run=true. On push/PR the
# filter runs and its 'code' output decides. (The build job also short-circuits
# its own if-condition on workflow_dispatch, so this keeps both in agreement.)
should_run: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.filter.outputs.code }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- id: filter
if: github.event_name != 'workflow_dispatch'
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
with:
# Under the default 'some' quantifier a negated rule still counts as a