-
Notifications
You must be signed in to change notification settings - Fork 30
Add link checker GitHub workflow #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| name: Link Checker | ||
| run-name: Link Checker (${{ github.event_name }} β’ ${{ github.ref_name }}) | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| # Only run when docs files change in either site | ||
| - 'main/**/*.md' | ||
| - 'main/**/*.mdx' | ||
| - 'main/**/*.jsx' | ||
| - 'auth4genai/**/*.md' | ||
| - 'auth4genai/**/*.mdx' | ||
| - 'auth4genai/**/*.jsx' | ||
| workflow_dispatch: {} # Manual run (full scan for both sites) | ||
|
|
||
| concurrency: | ||
| # One link-check run per ref; newer runs cancel older ones on the same branch/PR | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| link-check: | ||
| name: Link Checker (${{ matrix.site.name }}) | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read # required by checkout and changed-files | ||
|
|
||
| strategy: | ||
| # If one site fails (auth0 vs auth0-genai), do not cancel the other | ||
| fail-fast: false | ||
| matrix: | ||
| site: | ||
| - name: auth0 | ||
| path: main | ||
| - name: auth0-genai | ||
| path: auth4genai | ||
|
|
||
| steps: | ||
| - name: Checkout repo | ||
| # https://github.com/actions/checkout | ||
| # Pin to v6.0.0 tag commit for supply-chain safety | ||
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | ||
|
|
||
| - name: Get changed files | ||
| # Only needed on PRs; for manual runs we always scan everything | ||
| if: github.event_name == 'pull_request' | ||
| id: changed | ||
| # https://github.com/yumemi-inc/changed-files | ||
| # Pin to v3.2.0 tag commit for supply-chain safety | ||
| uses: yumemi-inc/changed-files@50f2544ad88b4f274eace9689431b7281132304c # v3.2.0 | ||
| with: | ||
| # Only consider docs files in the current site (from the matrix) | ||
| patterns: | | ||
| ${{ matrix.site.path }}/**/*.md | ||
| ${{ matrix.site.path }}/**/*.mdx | ||
| ${{ matrix.site.path }}/**/*.jsx | ||
| # Ignore deletions; we care about content that still exists | ||
| statuses: 'added|modified|renamed' | ||
| # Plain space-separated list, easier to feed into lychee args | ||
| format: 'plain' | ||
|
|
||
| - name: Decide Lychee targets | ||
| id: targets | ||
| # Run if: | ||
| # - not a PR (manual full scan), OR | ||
| # - PR with at least one changed file in this site | ||
| if: > | ||
| github.event_name != 'pull_request' || | ||
| steps.changed.outputs.files != '' | ||
| run: | | ||
| # On PRs, use the list of changed files from the previous step. | ||
| # On manual runs, scan the whole docs tree for that site. | ||
| echo "targets=${{ github.event_name == 'pull_request' && steps.changed.outputs.files || format('''{0}/**/*.md'' ''{0}/**/*.mdx'' ''{0}/**/*.jsx''', matrix.site.path) }}" >> "$GITHUB_OUTPUT" | ||
| - name: Run Lychee on target | ||
| id: lychee | ||
| # Skip if we somehow ended up with no targets | ||
| if: steps.targets.outputs.targets != '' | ||
| # https://github.com/lycheeverse/lychee-action | ||
| # Pin to v2.7.0 tag commit | ||
| uses: lycheeverse/lychee-action@a8c4c7cb88f0c7386610c35eb25108e448569cb0 # v2.7.0 | ||
| continue-on-error: true # let the job finish and report even if links are broken | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # used for GitHub API calls (e.g. rate limits, private links) | ||
| with: | ||
| fail: false # FIXME: Once the config, links, and fixes have stabilized, we should enable for hard block. For now this is just informative | ||
| # Important bits: | ||
| # - --root-dir ties file:// URLs to the correct site root | ||
| # - --format detailed + --verbose for useful CI logs | ||
| # - ${targets} is either changed files (PR) or whole tree (manual run) | ||
| args: > | ||
| --root-dir "$(pwd)/${{ matrix.site.path }}" | ||
| --format detailed | ||
| --verbose | ||
| ${{ steps.targets.outputs.targets }} | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,5 @@ temp/ | |
| *.py | ||
|
|
||
| .vite | ||
|
|
||
| .lycheecache | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this workflow is currently running in βsoftβ mode. It reports broken links but never fails the build. That gives us time to watch how noisy/flake-y it is before turning it into a blocking check.