Open 4r7if3x opened 1 month ago
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: ./**/*
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?