From 6d8808eea2dbe578992a406f25859cd0072f4061 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Fri, 25 Mar 2022 09:49:50 +0100 Subject: [PATCH 1/5] chore: add weekly check for broken markdown links --- .github/workflows/cron-weekly.yml | 30 +++++++++++++++++++ .../workflows/markdown-link-check-config.json | 8 +++++ 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/cron-weekly.yml create mode 100644 .github/workflows/markdown-link-check-config.json diff --git a/.github/workflows/cron-weekly.yml b/.github/workflows/cron-weekly.yml new file mode 100644 index 000000000000..72154a73d3a3 --- /dev/null +++ b/.github/workflows/cron-weekly.yml @@ -0,0 +1,30 @@ +name: Markdown Links Check +# runs every monday at 9 am +on: + push: + # TODO: Change from push to schedule once the testing is done + # schedule: + # - cron: "0 9 * * 1" + +jobs: + check-links: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + # checks all markdown files from important folders including all subfolders + with: + # only show errors that occur instead of successful links + errors + use-quiet-mode: 'yes' + # output full HTTP info for broken links + use-verbose-mode: 'yes' + config-file: '.github/workflows/markdown-link-check-config.json' + folder-path: 'addons, app, docs, lib' + - uses: actions/checkout@v2 + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + # checks all markdown files from root but ignores subfolders + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'yes' + config-file: '.github/workflows/markdown-link-check-config.json' + max-depth: 0 diff --git a/.github/workflows/markdown-link-check-config.json b/.github/workflows/markdown-link-check-config.json new file mode 100644 index 000000000000..96430add3bf1 --- /dev/null +++ b/.github/workflows/markdown-link-check-config.json @@ -0,0 +1,8 @@ +{ + "replacementPatterns": [ + { + "pattern": "^/", + "replacement": "./" + } + ] +} \ No newline at end of file From 8f053a545cb7d2b80a7f63927120dc66db547838 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Mon, 28 Mar 2022 19:25:24 +0200 Subject: [PATCH 2/5] separate steps --- .github/workflows/cron-weekly.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cron-weekly.yml b/.github/workflows/cron-weekly.yml index 72154a73d3a3..7efb7c69d54e 100644 --- a/.github/workflows/cron-weekly.yml +++ b/.github/workflows/cron-weekly.yml @@ -20,6 +20,9 @@ jobs: use-verbose-mode: 'yes' config-file: '.github/workflows/markdown-link-check-config.json' folder-path: 'addons, app, docs, lib' + check-root-links: + runs-on: ubuntu-latest + steps: - uses: actions/checkout@v2 - uses: gaurav-nelson/github-action-markdown-link-check@v1 # checks all markdown files from root but ignores subfolders From 9744defd86067b19d58243deb2e78767614d0d1a Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Mon, 28 Mar 2022 19:29:31 +0200 Subject: [PATCH 3/5] try running in the entire monorepo --- .github/workflows/cron-weekly.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/cron-weekly.yml b/.github/workflows/cron-weekly.yml index 7efb7c69d54e..3c05a3a582d1 100644 --- a/.github/workflows/cron-weekly.yml +++ b/.github/workflows/cron-weekly.yml @@ -19,15 +19,3 @@ jobs: # output full HTTP info for broken links use-verbose-mode: 'yes' config-file: '.github/workflows/markdown-link-check-config.json' - folder-path: 'addons, app, docs, lib' - check-root-links: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: gaurav-nelson/github-action-markdown-link-check@v1 - # checks all markdown files from root but ignores subfolders - with: - use-quiet-mode: 'yes' - use-verbose-mode: 'yes' - config-file: '.github/workflows/markdown-link-check-config.json' - max-depth: 0 From 2036df21fc9e35f898656fb573ee5b55107e515e Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Mon, 28 Mar 2022 22:18:31 +0200 Subject: [PATCH 4/5] ignore certain links in markdown check --- .github/workflows/markdown-link-check-config.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/markdown-link-check-config.json b/.github/workflows/markdown-link-check-config.json index 96430add3bf1..df6db06fff2e 100644 --- a/.github/workflows/markdown-link-check-config.json +++ b/.github/workflows/markdown-link-check-config.json @@ -4,5 +4,16 @@ "pattern": "^/", "replacement": "./" } + ], + "ignorePatterns": [ + { + "pattern": "localhost" + }, + { + "pattern": "https://github.com/storybookjs/storybook/pull/*" + }, + { + "pattern": "https://stackblitz.com/*" + } ] } \ No newline at end of file From 9bc458024ce955f3c44b3b26d02d1d40f40e084d Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Mon, 28 Mar 2022 22:30:48 +0200 Subject: [PATCH 5/5] update cron job to run every monday at 9am --- .github/workflows/cron-weekly.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cron-weekly.yml b/.github/workflows/cron-weekly.yml index 3c05a3a582d1..7b056c6148fc 100644 --- a/.github/workflows/cron-weekly.yml +++ b/.github/workflows/cron-weekly.yml @@ -1,10 +1,8 @@ name: Markdown Links Check # runs every monday at 9 am on: - push: - # TODO: Change from push to schedule once the testing is done - # schedule: - # - cron: "0 9 * * 1" + schedule: + - cron: "0 9 * * 1" jobs: check-links: