fkirc / skip-duplicate-actions

Save time and cost when using GitHub Actions
Other
457 stars 40 forks source link

[Feature request] Detect changes in all commits in a pull request #330

Closed jbnjohnathan closed 10 months ago

jbnjohnathan commented 1 year ago

We use this tool only for pull requests and as such we would like to backtrack to include all commits in the specific pull request. If I understand the config options correctly we need to set a hard number of commits to look back on, rather than have it include all commits in the pull request.

A feature to set this to all_pr_commits: true would be really helpful

Maxim-Durand commented 11 months ago

You probably found the solution already but for future readers, the easiest solution is to specify a limit to the backtracking like in the example below :

- id: skip_check
  uses: fkirc/skip-duplicate-actions@v5.3.0
  with:
    paths_filter: |
      your_filter_name:
        paths:
          - 'your_path/**'
        paths_ignore:
          - 'a_different_path/**'
        # This backtracking limit is needed otherwise it will search beyond the PR's commits
        # ${{  github.event.pull_request.commits }} == number of commits in this PR
        backtracking: ${{  github.event.pull_request.commits }}

For more details on github.event.pull_request.commits read https://docs.github.com/en/webhooks/webhook-events-and-payloads#pull_request

fkirc commented 10 months ago

I like the solution proposed by @Maxim-Durand so I feel we can close this issue.

Anyways, we will keep using the backtracking-algorithm for tracking changes, because that is the core of this Action. It someone does not like the commit-backtracking, then they should probably use another Action like https://github.com/dorny/paths-filter which does not do any commit-backtracking.