dorny / paths-filter

Conditionally run actions based on files modified by PR, feature branch or pushed commits
MIT License
1.98k stars 230 forks source link

Trigger flow based on release tag #130

Open sharmmoh1983 opened 2 years ago

sharmmoh1983 commented 2 years ago

We are trying to trigger filter based on release tag but it is not happening . Do you have a working sample . I saw similar issue posted but I was looking for specific example

on:
  push:
    tags:
       - 'prod-v[0-9]+.[0-9]+.[0-9]+'

 - uses: dorny/paths-filter@v2
        id: filter
        with:
          base: main
dod38fr commented 1 year ago

I guess that you're placing your prod-v* tags on main branch.

I've faced a similar problem where the tag is place on the "base" branch (e.g ci/fix-fail-behavior in the example below): 2022-10-28_15-37

There I've seen that path-filter is checking the files changed between the top of the base branch and the tag. Unfortunately, the same commit is referenced by HEAD and the tag, since I've pushed the tag after the branch, so no changes are found.

The only work-around I can think of is to set the "base" branch to the previous tag, i.e. a tag found with git describe --tags --abbrev=0 HEAD~1.

dod38fr commented 1 year ago

This work-around is fine provided actions/checkout@v3 was set with fetch-depth: 0.