Check external links #71
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: Check external links | |
on: | |
schedule: ## Do a run once daily, to catch new regressions | |
- cron: '45 10 * * *' | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: uses-github-api # do not allow any concurrency or the different builds will risk creating multiple issues | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
repository-projects: read | |
statuses: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Restoring cached GitHub API results | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.cache-github-api | |
key: gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }}-${{ github.run_id }}-${{ github.run_attempt }} | |
restore-keys: | # If there are multiple partial matches for a restore key, the action returns the most recently created cache. | |
gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }} | |
gatsby-build-github-queries- | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: "npm" # this only caches global dependencies | |
- run: npm ci --prefer-offline | |
- run: npm run build -- ${{ github.ref_name == 'main' && '--prefix-paths' || '' }} | |
env: | |
NODE_ENV: production | |
GATSBY_ACTIVE_ENV: production | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY }} | |
- name: Caching GitHub API results | |
uses: actions/cache/save@v3 # save the cache even if the integration tests fail | |
with: | |
path: | | |
.cache-github-api | |
key: gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }}-${{ github.run_id }}-${{ github.run_attempt }} | |
- run: npm run test:links | |
env: | |
CI: true | |
PATH_PREFIX: "${{ github.ref_name == 'main' && 'extensions' || '' }}" | |
PATH_PREFIX_FLAG: "${{ github.ref_name == 'main' && '--prefix-paths' || '' }}" | |
- name: Raise defects if needed | |
uses: jbangdev/jbang-action@v0.111.0 | |
if: always() # we *especially* want to run this if the link checker failed | |
with: | |
script: util/dead-link-issue.java | |
scriptargs: token=${{ secrets.GITHUB_TOKEN }} issueRepo=${{ github.repository }} runId=${{ github.run_id }} siteUrl=https://quarkus.io/extensions |