|
| 1 | +name: MarkDown |
| 2 | + |
| 3 | +on: |
| 4 | + # Run on all pushes and on all pull requests. |
| 5 | + push: |
| 6 | + pull_request: |
| 7 | + # Also run this workflow every Monday at 6:00. |
| 8 | + schedule: |
| 9 | + - cron: '0 6 * * 1' |
| 10 | + # Allow manually triggering the workflow. |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +# Cancels all previous workflow runs for the same branch that have not yet completed. |
| 14 | +concurrency: |
| 15 | + # The concurrency group contains the workflow name and the branch name. |
| 16 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + markdownlint: |
| 21 | + name: 'Lint Markdown' |
| 22 | + runs-on: ubuntu-latest |
| 23 | + |
| 24 | + # Don't run the cronjob in this workflow on forks. |
| 25 | + if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'Yoast') |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout code |
| 29 | + uses: actions/checkout@v3 |
| 30 | + |
| 31 | + # This action also handles the caching of the dependencies. |
| 32 | + # https://github.com/actions/setup-node |
| 33 | + - name: Set up node and enable caching of dependencies |
| 34 | + uses: actions/setup-node@v3 |
| 35 | + with: |
| 36 | + node-version: '16' |
| 37 | + |
| 38 | + # @link https://github.com/DavidAnson/markdownlint-cli2 |
| 39 | + # @link https://github.com/DavidAnson/markdownlint |
| 40 | + - name: Install Markdownlint CLI2 |
| 41 | + run: npm install -g markdownlint-cli2 |
| 42 | + |
| 43 | + # @link https://github.com/marketplace/actions/problem-matcher-for-markdownlint-cli |
| 44 | + - name: Enable showing issue in PRs |
| 45 | + uses: xt0rted/markdownlint-problem-matcher@v2 |
| 46 | + |
| 47 | + - name: Check markdown with CLI2 |
| 48 | + run: markdownlint-cli2 |
| 49 | + |
| 50 | + remark: |
| 51 | + name: 'QA Markdown' |
| 52 | + runs-on: ubuntu-latest |
| 53 | + |
| 54 | + # Don't run the cronjob in this workflow on forks. |
| 55 | + if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'Yoast') |
| 56 | + |
| 57 | + steps: |
| 58 | + - name: Checkout code |
| 59 | + uses: actions/checkout@v3 |
| 60 | + |
| 61 | + - name: Set up node and enable caching of dependencies |
| 62 | + uses: actions/setup-node@v3 |
| 63 | + with: |
| 64 | + node-version: '16' |
| 65 | + |
| 66 | + # To make the command available on CLI, it needs to be installed globally. |
| 67 | + - name: Install Remark CLI globally |
| 68 | + run: npm install --global remark-cli --foreground-scripts true --fund false |
| 69 | + |
| 70 | + # To allow for creating a custom config which references rules which are included |
| 71 | + # in the presets, without having to install all rules individually, a local install |
| 72 | + # works best (and installing the presets in the first place, of course). |
| 73 | + # |
| 74 | + # Note: the first group of packages are all part of the mono "Remark lint" repo. |
| 75 | + # The second group of packages (heading-whitespace and down) are additional |
| 76 | + # "external" rules/plugins. |
| 77 | + - name: Install Remark rules locally |
| 78 | + run: > |
| 79 | + npm install --foreground-scripts true --fund false |
| 80 | + remark-lint |
| 81 | + remark-gfm |
| 82 | + remark-preset-lint-consistent |
| 83 | + remark-preset-lint-recommended |
| 84 | + remark-preset-lint-markdown-style-guide |
| 85 | + remark-lint-checkbox-content-indent |
| 86 | + remark-lint-linebreak-style |
| 87 | + remark-lint-no-empty-url |
| 88 | + remark-lint-no-heading-like-paragraph |
| 89 | + remark-lint-no-reference-like-url |
| 90 | + remark-lint-no-unneeded-full-reference-image |
| 91 | + remark-lint-no-unneeded-full-reference-link |
| 92 | + remark-lint-strikethrough-marker |
| 93 | + remark-lint-heading-whitespace |
| 94 | + remark-lint-list-item-punctuation |
| 95 | + remark-lint-match-punctuation |
| 96 | + remark-lint-no-hr-after-heading |
| 97 | + remark-lint-are-links-valid-alive |
| 98 | + remark-lint-are-links-valid-duplicate |
| 99 | + remark-validate-links |
| 100 | +
|
| 101 | + - name: Run Remark-lint |
| 102 | + run: remark . --frail |
| 103 | + |
| 104 | + # @link https://github.com/reviewdog/action-remark-lint |
| 105 | + - name: Show Remark-lint annotations in PR |
| 106 | + if: ${{ failure() && github.event_name == 'pull_request' }} |
| 107 | + uses: reviewdog/action-remark-lint@v5 |
| 108 | + with: |
| 109 | + fail_on_error: true |
| 110 | + install_deps: false |
| 111 | + level: info |
| 112 | + reporter: github-pr-check |
0 commit comments