From aa11fec4838716c63906073151251f07e7132d20 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Fri, 21 Jul 2023 11:42:24 +0100 Subject: [PATCH 1/5] Quote advanced glob expression in markdownlint invocation As mentioned in : > `markdownlint-cli` supports advanced globbing patterns like `**/*.md`. > With shells like Bash, it may be necessary to quote globs > so they are not interpreted by the shell. --- .github/workflows/pull-request-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-checks.yml b/.github/workflows/pull-request-checks.yml index 355d05f..2eed964 100644 --- a/.github/workflows/pull-request-checks.yml +++ b/.github/workflows/pull-request-checks.yml @@ -13,4 +13,4 @@ jobs: - uses: actions/checkout@v3 - uses: xt0rted/markdownlint-problem-matcher@v2 - run: npm install -g markdownlint-cli - - run: markdownlint **/*.md + - run: markdownlint '**/*.md' From 0d48ca5f45345740d0475038b229610ee8966a76 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Wed, 4 Oct 2023 00:27:35 +0100 Subject: [PATCH 2/5] CI: List files that markdownlint-cli processes --- .github/workflows/pull-request-checks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull-request-checks.yml b/.github/workflows/pull-request-checks.yml index 2eed964..1ad4155 100644 --- a/.github/workflows/pull-request-checks.yml +++ b/.github/workflows/pull-request-checks.yml @@ -13,4 +13,5 @@ jobs: - uses: actions/checkout@v3 - uses: xt0rted/markdownlint-problem-matcher@v2 - run: npm install -g markdownlint-cli + - run: npx --silent glob '**/*.md' - run: markdownlint '**/*.md' From df411646844f92ab247b5677b2c17053430524a7 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Wed, 4 Oct 2023 00:30:21 +0100 Subject: [PATCH 3/5] CI: Add markdownlint rule to check for undefined reference links By default, markdownlint detects missing link targets in reference links written in the "collapsed syntax" `[foo][]`, but not if they use the "shortcut syntax" [foo]. Since markdownlint 0.31.0, the rule MD052/reference-links-images now supports a `shortcut_syntax` boolean parameter that allows opting-in to checking shortcut syntax links as well. This requires markdownlint-cli v0.37.0 or above, but since our GitHub Actions setup fetches the latest available version, we already have access to it in the CI pipeline, so we only need to add the rule and parameter in the markdownlint configuration file. --- .markdownlint.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.markdownlint.yml b/.markdownlint.yml index 71fb1ef..f2c7554 100644 --- a/.markdownlint.yml +++ b/.markdownlint.yml @@ -27,3 +27,8 @@ MD024: MD026: # Trailing punctuation characters not allowed in headings punctuation: ",;:!" + +# MD052/reference-links-images +MD052: + # Validate shortcut-style links + shortcut_syntax: true From 5884f4e4245cb7665fe8a527124b0666892dc270 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Wed, 4 Oct 2023 00:39:43 +0100 Subject: [PATCH 4/5] CI: Improve comments and add step names --- .github/workflows/pull-request-checks.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull-request-checks.yml b/.github/workflows/pull-request-checks.yml index 1ad4155..06b8d9b 100644 --- a/.github/workflows/pull-request-checks.yml +++ b/.github/workflows/pull-request-checks.yml @@ -1,17 +1,22 @@ name: "Pull Request Checks" on: pull_request jobs: - # Enforce the update of the changelog file + # Ensure that the changelog file has been updated in this PR check-changelog-change: runs-on: ubuntu-latest steps: - uses: dangoslen/changelog-enforcer@v3 - # Ensure markdown files are formatted consistently + # Ensure that markdown files are formatted consistently (according to .markdownlint.yml) lint-markdown-files: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: xt0rted/markdownlint-problem-matcher@v2 - - run: npm install -g markdownlint-cli - - run: npx --silent glob '**/*.md' - - run: markdownlint '**/*.md' + - name: Fetch the Wikimate code into the Actions runner + uses: actions/checkout@v3 + - name: Install the markdownlint-problem-matcher action + uses: xt0rted/markdownlint-problem-matcher@v2 + - name: Install markdownlint-cli + run: npm install -g markdownlint-cli + - name: List files that will be processed + run: npx --silent glob '**/*.md' + - name: Run markdownlint + run: markdownlint '**/*.md' From 4cd37b04f41a40e3934a3fef55e31d2190e60cb1 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Wed, 4 Oct 2023 00:40:35 +0100 Subject: [PATCH 5/5] Add CHANGELOG.md entry for the GitHub Actions changes --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23a015f..d3f5a93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,10 @@ and [Keep a Changelog](http://keepachangelog.com/). - Clarified instructions in `GOVERNANCE.md` for releasing new versions ([#157]) - Updated versions of GitHub Actions dependencies ([#161]) +- Fixed markdownlint execution in the CI pipeline ([#154]) +[#154]: https://github.com/hamstar/Wikimate/pull/154 [#157]: https://github.com/hamstar/Wikimate/pull/157 [#161]: https://github.com/hamstar/Wikimate/pull/161