diff --git a/.github/workflows/pr-check_redirects_file.yml b/.github/workflows/pr-check_redirects_file.yml index 95e90da1e5d2eff..45a1b9a8ac1391b 100644 --- a/.github/workflows/pr-check_redirects_file.yml +++ b/.github/workflows/pr-check_redirects_file.yml @@ -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: @@ -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/paths-filter@v2.2.1 + id: filter + with: + filters: | + required_files : + - "files/en-us/_redirects.txt" + - ".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 diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index db3028a686eda1e..f54897a14ef5122 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -10,10 +10,6 @@ on: pull_request: branches: - main - paths: - - .nvmrc - - ".github/workflows/pr-test.yml" - - "files/en-us/**" jobs: tests: @@ -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/paths-filter@v2.2.1 + 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