mirror of
https://github.com/dorny/paths-filter.git
synced 2025-06-08 18:09:04 +00:00
Enable custom ref and base on PRs
This commit is contained in:
parent
8c7f485a57
commit
b0bc141e31
6 changed files with 156 additions and 15 deletions
79
.github/workflows/pull-request-verification.yml
vendored
79
.github/workflows/pull-request-verification.yml
vendored
|
@ -135,3 +135,82 @@ jobs:
|
|||
|| steps.filter.outputs.modified_files != 'LICENSE'
|
||||
|| steps.filter.outputs.deleted_files != 'README.md'
|
||||
run: exit 1
|
||||
|
||||
test-baseref-changes:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ./
|
||||
id: filter
|
||||
with:
|
||||
base: ${{ github.base_ref }}
|
||||
ref: ${{ github.sha }}
|
||||
filters: |
|
||||
error:
|
||||
- not_existing_path/**/*
|
||||
any:
|
||||
- "**/*"
|
||||
- name: filter-test
|
||||
if: steps.filter.outputs.any != 'true' || steps.filter.outputs.error == 'true'
|
||||
run: exit 1
|
||||
- name: changes-test
|
||||
if: contains(fromJSON(steps.filter.outputs.changes), 'error') || !contains(fromJSON(steps.filter.outputs.changes), 'any')
|
||||
run: exit 1
|
||||
|
||||
test-custom-nostatus:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: |
|
||||
base=${{ github.base_ref }}
|
||||
compare=${{ github.sha }}
|
||||
git fetch origin $base:$base
|
||||
echo 'customchanges<<EOF' >> $GITHUB_ENV
|
||||
git diff --name-only $base..$compare >> $GITHUB_ENV
|
||||
echo 'EOF' >> $GITHUB_ENV
|
||||
- uses: ./
|
||||
id: filter
|
||||
with:
|
||||
files: ${{ env.customchanges }}
|
||||
filters: |
|
||||
error:
|
||||
- not_existing_path/**/*
|
||||
any:
|
||||
- "**/*"
|
||||
- name: filter-test
|
||||
if: steps.filter.outputs.any != 'true' || steps.filter.outputs.error == 'true'
|
||||
run: exit 1
|
||||
- name: changes-test
|
||||
if: contains(fromJSON(steps.filter.outputs.changes), 'error') || !contains(fromJSON(steps.filter.outputs.changes), 'any')
|
||||
run: exit 1
|
||||
|
||||
test-custom-withstatus:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: |
|
||||
base=${{ github.base_ref }}
|
||||
compare=${{ github.sha }}
|
||||
git fetch origin $base:$base
|
||||
echo 'customchanges<<EOF' >> $GITHUB_ENV
|
||||
git diff --name-status $base..$compare >> $GITHUB_ENV
|
||||
echo 'EOF' >> $GITHUB_ENV
|
||||
- uses: ./
|
||||
id: filter
|
||||
with:
|
||||
files: ${{ env.customchanges }}
|
||||
filters: |
|
||||
error:
|
||||
- not_existing_path/**/*
|
||||
any:
|
||||
- "**/*"
|
||||
- name: filter-test
|
||||
if: steps.filter.outputs.any != 'true' || steps.filter.outputs.error == 'true'
|
||||
run: exit 1
|
||||
- name: changes-test
|
||||
if: contains(fromJSON(steps.filter.outputs.changes), 'error') || !contains(fromJSON(steps.filter.outputs.changes), 'any')
|
||||
run: exit 1
|
Loading…
Add table
Add a link
Reference in a new issue