#7178·woodpecker

Support path conditions on tag events

Author: omniadonumCreated Sep 24, 2026Updated Sep 24, 2026
Labelsfeature

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:

yaml
when:
  - event: tag
    path: images/foo/**   # no-op on tag; step runs regardless

This 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.

yaml
when:
  - event: tag
    path: images/foo/**   # runs only if images/foo changed since the previous release

Defining "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

Source: woodpecker-ci/woodpecker