Extend output with change status counts #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Pull Request Verification' | ||
Check failure on line 1 in .github/workflows/pull-request-verification.yml GitHub Actions / Pull Request VerificationInvalid workflow file
|
||
on: | ||
pull_request: | ||
paths-ignore: ['*.md'] | ||
branches: | ||
- master | ||
- '**' | ||
env: | ||
VOLTA_FEATURE_PNPM: 1 | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Need history for changelog generation | ||
- uses: volta-cli/action@v4 | ||
- run: | | ||
pnpm i | ||
pnpm run all | ||
# We need to make sure the checked-in `index.mjs` actually matches what we expect it to be. | ||
- name: Compare the expected and actual dist/ directories | ||
run: | | ||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | ||
echo "Detected uncommitted changes after build. See status below:" | ||
git diff | ||
exit 1 | ||
fi | ||
test-inline: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./ | ||
id: filter | ||
with: | ||
filters: | | ||
error: | ||
- not_existing_path/**/* | ||
any: | ||
- "**/*" | ||
- name: Dump output | ||
env: | ||
OUTPUT: ${{ toJson(steps.filter.outputs) }} | ||
run: echo "$OUTPUT" | ||
- 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-external: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./ | ||
id: filter | ||
with: | ||
filters: '.github/filters.yml' | ||
- name: Dump output | ||
env: | ||
OUTPUT: ${{ toJson(steps.filter.outputs) }} | ||
run: echo "$OUTPUT" | ||
- name: filter-test | ||
if: steps.filter.outputs.any != 'true' || steps.filter.outputs.error == 'true' | ||
run: exit 1 | ||
test-without-token: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./ | ||
id: filter | ||
with: | ||
token: '' | ||
filters: '.github/filters.yml' | ||
- name: Dump output | ||
env: | ||
OUTPUT: ${{ toJson(steps.filter.outputs) }} | ||
run: echo "$OUTPUT" | ||
- name: filter-test | ||
if: steps.filter.outputs.any != 'true' || steps.filter.outputs.error == 'true' | ||
run: exit 1 | ||
test-wd-without-token: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: somewhere | ||
- uses: ./somewhere | ||
id: filter | ||
with: | ||
token: '' | ||
working-directory: somewhere | ||
filters: '.github/filters.yml' | ||
- name: Dump output | ||
env: | ||
OUTPUT: ${{ toJson(steps.filter.outputs) }} | ||
run: echo "$OUTPUT" | ||
- name: filter-test | ||
if: steps.filter.outputs.any != 'true' || steps.filter.outputs.error == 'true' | ||
run: exit 1 | ||
test-local-changes: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: echo "NEW FILE" > local | ||
- run: git add local | ||
- uses: ./ | ||
id: filter | ||
with: | ||
base: HEAD | ||
filters: | | ||
local: | ||
- local | ||
- name: Dump output | ||
env: | ||
OUTPUT: ${{ toJson(steps.filter.outputs) }} | ||
run: echo "$OUTPUT" | ||
- name: filter-test | ||
if: steps.filter.outputs.local != 'true' | ||
run: exit 1 | ||
- name: count-test | ||
if: steps.filter.outputs.local_count != 1 | ||
run: exit 1 | ||
- name: added-test | ||
if: steps.filter.outputs.local_added != 1 | ||
run: exit 1 | ||
- name: modified-test | ||
# testing whether the local_modified is falsy | ||
if: !steps.filter.outputs.local_modified | ||
run: exit 1 |