Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force Push Unexpected Behavior #240

Open
4r7if3x opened this issue May 25, 2024 · 1 comment
Open

Force Push Unexpected Behavior #240

4r7if3x opened this issue May 25, 2024 · 1 comment

Comments

@4r7if3x
Copy link

4r7if3x commented May 25, 2024

I noticed the test would not work as expected when a force push happens, since the pushed commit is checked against itself, hence only the changes in comparison with the previous version of the commit are put into consideration. Although this looks to be the correct behavior, it can cause issues in some scenarios as I expected to detect the existence of the filter in the pushed commit.

Since I believe both behaviors can be beneficial to certain needs, can we have an additional option for this action to let us choose between the two? Or is it currently hackable through the current options?

@ajgon
Copy link

ajgon commented Jul 3, 2024

For everyone stumbling upon this problem (as I did), here is a workaround:

      - uses: actions/checkout@v4
        with:
          fetch-depth: 2  # important, to fetch previous commit

      # workaround for https://github.com/dorny/paths-filter/issues/240
      - id: previous-sha
        run: 'echo "sha=$(git rev-list -n 1 ${{ github.ref }}^)" >> $GITHUB_OUTPUT'

      - uses: dorny/paths-filter@v3
        id: filter
        with:
          base: "${{ steps.previous-sha.outputs.sha }}"
          filters: |
            myfilters: ./**/*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants