Skip to content

Commit

Permalink
Avoid path filering for 'requried' workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
OnkarRuikar committed Jul 31, 2023
1 parent 161c015 commit a4d7747
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/pr-check_redirects_file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
pull_request:
branches:
- main
paths:
- files/en-us/_redirects.txt
- .github/workflows/pr-check_redirects_file.yml

jobs:
check-redirects:
Expand All @@ -21,11 +18,24 @@ jobs:
node-version-file: ".nvmrc"
cache: yarn

# This is a "requried" workflow so path filtering can not be used:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
# We have to rely on a custom filering mechanism to run the checks only on required files.
- uses: dorny/[email protected]
id: filter
with:
filters: |
required_files :
- modified: 'files/en-us/_redirects.txt'
- modified: '.github/workflows/pr-check_redirects_file.yml'
- name: Install all yarn packages
if: steps.filter.outputs.required_files == 'true'
run: yarn --frozen-lockfile
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check 'files/en-us/_redirects.txt' file
if: steps.filter.outputs.required_files == 'true'
run: yarn content validate-redirects en-us --strict
18 changes: 14 additions & 4 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ on:
pull_request:
branches:
- main
paths:
- .nvmrc
- ".github/workflows/pr-test.yml"
- "files/en-us/**"

jobs:
tests:
Expand All @@ -31,13 +27,27 @@ jobs:
node-version-file: ".nvmrc"
cache: yarn

# This is a "requried" workflow so path filtering can not be used:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
# We have to rely on a custom filering mechanism to run the checks only on required files.
- uses: dorny/[email protected]
id: filter
with:
filters: |
required_files :
- ".nvmrc"
- ".github/workflows/pr-test.yml"
- "files/en-us/**"
- name: Install all yarn packages
if: steps.filter.outputs. required_files == 'true'
run: yarn --frozen-lockfile
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get changed files
if: steps.filter.outputs.required_files == 'true'
run: |
# Use the GitHub API to get the list of changed files
# documenation: https://docs.github.com/rest/commits/commits#compare-two-commits
Expand Down

0 comments on commit a4d7747

Please sign in to comment.