Enable custom ref and base on PRs

This commit is contained in:
Henry Painter 2022-08-11 23:10:18 +01:00
parent 8c7f485a57
commit b0bc141e31
6 changed files with 156 additions and 15 deletions

View file

@ -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