1
0
mirror of synced 2025-12-26 05:02:55 -05:00

On PRs only check URLs in github/github that are relevant (#49902)

This commit is contained in:
Peter Bengtsson
2024-03-27 17:46:26 -04:00
committed by GitHub
parent fb311a5b97
commit 48912fd5e7
3 changed files with 86 additions and 7 deletions

View File

@@ -8,7 +8,15 @@ on:
workflow_dispatch:
schedule:
- cron: '20 16 * * *' # Run every day at 16:20 UTC / 8:20 PST
# pull_request: # Temporarily commented out. See internal issue 4152
pull_request:
paths:
- 'content/**'
# In case a relevant dependency changes
- 'package*.json'
# The scripts
- 'src/links/scripts/validate-github-github-docs-urls/**'
# The workflow
- .github/workflows/validate-github-github-docs-urls.yml
permissions:
contents: read
@@ -90,13 +98,28 @@ jobs:
# In the latter case, you might want to update the URL in docs-urls.json
# after this PR has landed, or consider using `<a name="..."></a>` as a
# workaround for the time being.
# First, gather the URLs that were relevant
- name: Get changed content/data files
id: changed-files
uses: tj-actions/changed-files@77af4bed286740ef1a6387dc4e4e4dec39f96054 # v43.0.0
with:
# No need to escape the file names because we make the output of
# tj-actions/changed-files be set as an environment variable. Not
# as a direct input to the line of bash that uses it.
safe_output: false
files: |
content/**
- name: Generate PR comment
if: ${{ github.event_name == 'pull_request' }}
if: ${{ github.event_name == 'pull_request' && steps.changed-files.outputs.any_changed == 'true' }}
env:
# Make it an environment variable so that its value doesn't need to be escaped.
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
CHANGED_FILES: |-
${{ steps.changed-files.outputs.all_changed_files }}
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
ISSUE_NUMBER: ${{ github.event.pull_request.number }}
REPOSITORY: ${{ github.repository }}
run: npm run validate-github-github-docs-urls -- post-pr-comment checks.json
run: npm run validate-github-github-docs-urls -- post-pr-comment checks.json --changed-files $CHANGED_FILES
- uses: ./.github/actions/slack-alert
if: ${{ failure() && github.event_name == 'schedule' }}