Support path conditions on tag events
Clear and concise description of the problem
path conditions are only evaluated for push and pull_request events (constraint.go#L184-186). On a tag event the path filter is silently ignored and the step always runs, even when written in the same when entry:
when:
- event: tag
path: images/foo/** # no-op on tag; step runs regardlessThis makes it impossible to gate work on a tagged release by what changed. The concrete use case is a release pipeline that rebuilds only the images whose build context changed since the previous tag.
Suggested solution
Evaluate path for event: tag as it is for push/PR, diffing previousTag..tag.
when:
- event: tag
path: images/foo/** # runs only if images/foo changed since the previous releaseDefining "previous tag" is a design decision. The natural default is the nearest tag in the tagged commit's ancestry (git describe --tags --abbrev=0 <tag>^), i.e. graph-nearest; this equals the previous release on linear tag history. Graph-distance, creation-time, and semver ordering can disagree on branchy history or when non-release tags are present, so the exact rule (and an optional release-tag match filter) needs to be considered. The on_empty option covers the first-release case where no previous tag exists.
Note: changed-files today comes from the forge webhook, which a tag event does not carry as a prev-tag delta; this likely needs a forge compare call (previousTag...tag) or a non-shallow fetch to resolve the previous tag. It is also a behavior change, since such steps run unconditionally today, so it may warrant being opt-in.
Alternative
Userland workaround in use today: a plan step runs git diff <previous-tag>..<tag> and writes a build-list file to the shared workspace, and every build step self-skips with a guard reading that file. It works but needs git fetch --unshallow, shared state, and a guard duplicated across every step. Other alternatives (switching the release lane to event: push so path applies) lose the tag-anchored release semantics.
Additional context
No response
Validations
- Checked that the feature isn't part of the
nextversion already [https://woodpecker-ci.org/versions] - Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Source: woodpecker-ci/woodpecker