From 29f704f59c8f0c62a67cf9ffd555fd98874bb22d Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Thu, 11 Jan 2024 14:36:33 +0000 Subject: [PATCH] chore: add action to check for dead links (#3992) # Description ## Problem\* Resolves ## Summary\* Testing this atm ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [ ] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- .github/DEAD_LINKS_IN_DOCS.md | 11 +++++++++ .github/NIGHTLY_TEST_FAILURE.md | 11 --------- .github/workflows/docs-dead-links.yml | 35 +++++++++++++++++++++++++++ docs/link-check.config.json | 7 ++++++ 4 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 .github/DEAD_LINKS_IN_DOCS.md delete mode 100644 .github/NIGHTLY_TEST_FAILURE.md create mode 100644 .github/workflows/docs-dead-links.yml create mode 100644 docs/link-check.config.json diff --git a/.github/DEAD_LINKS_IN_DOCS.md b/.github/DEAD_LINKS_IN_DOCS.md new file mode 100644 index 00000000000..b1671276dcf --- /dev/null +++ b/.github/DEAD_LINKS_IN_DOCS.md @@ -0,0 +1,11 @@ +--- +title: "Docs contains dead links" +assignees: signorecello catmcgee critesjosh jzaki Savio-Sou +labels: documentation +--- + +Some of the external links in the docs are now dead. This is likely due to the thing being linked to being moved. + +Check the [Check Markdown links]({{env.WORKFLOW_URL}}) workflow for details. + +This issue was raised by the workflow `{{env.WORKFLOW_NAME}}` diff --git a/.github/NIGHTLY_TEST_FAILURE.md b/.github/NIGHTLY_TEST_FAILURE.md deleted file mode 100644 index 05772d82a51..00000000000 --- a/.github/NIGHTLY_TEST_FAILURE.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "nightly test-integration failed" -assignees: kobyhallx, tomafrench, jonybur -labels: bug ---- - -Something broke our nightly integration test. - -Check the [test]({{env.WORKFLOW_URL}}) workflow for details. - -This issue was raised by the workflow `{{env.WORKFLOW_NAME}}` diff --git a/.github/workflows/docs-dead-links.yml b/.github/workflows/docs-dead-links.yml new file mode 100644 index 00000000000..ffb18fa0eb2 --- /dev/null +++ b/.github/workflows/docs-dead-links.yml @@ -0,0 +1,35 @@ +name: Check Markdown links + +on: + schedule: + # Run a check at 9 AM UTC + - cron: "0 9 * * *" + +# This will cancel previous runs when a branch or PR is updated +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} + cancel-in-progress: true + + +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: 'yes' + config-file: ./docs/link-check.config.json + folder-path: ./docs + + # Raise an issue if the previous step failed due to dead links being found + - name: Alert on dead links + uses: JasonEtco/create-an-issue@v2 + if: ${{ failure() }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WORKFLOW_NAME: ${{ github.workflow }} + WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ github.job }} + with: + update_existing: true + filename: .github/DEAD_LINKS_IN_DOCS.md diff --git a/docs/link-check.config.json b/docs/link-check.config.json new file mode 100644 index 00000000000..68059476958 --- /dev/null +++ b/docs/link-check.config.json @@ -0,0 +1,7 @@ +{ + "ignorePatterns": [ + { + "pattern": "^[^\/]+\/[^\/].*$|^\/[^\/].*$" + } + ] +}