Debian Codegraph @

.github/workflows/check-markdown-task.yml

raw
1 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-markdown-task.md
2 name: Check Markdown
3
4 # See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
5 on:
6 create:
7 push:
8 paths:
9 - ".github/workflows/check-markdown-task.ya?ml"
10 - ".markdown-link-check.json"
11 - "package.json"
12 - "package-lock.json"
13 - "Taskfile.ya?ml"
14 - "**/.markdownlint*"
15 - "**.mdx?"
16 - "**.mkdn"
17 - "**.mdown"
18 - "**.markdown"
19 pull_request:
20 paths:
21 - ".github/workflows/check-markdown-task.ya?ml"
22 - ".markdown-link-check.json"
23 - "package.json"
24 - "package-lock.json"
25 - "Taskfile.ya?ml"
26 - "**/.markdownlint*"
27 - "**.mdx?"
28 - "**.mkdn"
29 - "**.mdown"
30 - "**.markdown"
31 schedule:
32 # Run every Tuesday at 8 AM UTC to catch breakage caused by external changes.
33 - cron: "0 8 * * TUE"
34 workflow_dispatch:
35 repository_dispatch:
36
37 jobs:
38 run-determination:
39 runs-on: ubuntu-latest
40 outputs:
41 result: ${{ steps.determination.outputs.result }}
42 steps:
43 - name: Determine if the rest of the workflow should run
44 id: determination
45 run: |
46 RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
47 # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
48 if [[
49 "${{ github.event_name }}" != "create" ||
50 "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
51 ]]; then
52 # Run the other jobs.
53 RESULT="true"
54 else
55 # There is no need to run the other jobs.
56 RESULT="false"
57 fi
58
59 echo "::set-output name=result::$RESULT"
60
61 lint:
62 needs: run-determination
63 if: needs.run-determination.outputs.result == 'true'
64 runs-on: ubuntu-latest
65
66 steps:
67 - name: Checkout repository
68 uses: actions/checkout@v7
69
70 - name: Setup Node.js
71 uses: actions/setup-node@v7
72 with:
73 node-version-file: package.json
74
75 - name: Initialize markdownlint-cli problem matcher
76 uses: xt0rted/markdownlint-problem-matcher@v3
77
78 - name: Install Task
79 uses: arduino/setup-task@v3
80 with:
81 repo-token: ${{ secrets.GITHUB_TOKEN }}
82 version: 3.x
83
84 - name: Lint
85 run: task markdown:lint
86
87 links:
88 needs: run-determination
89 if: needs.run-determination.outputs.result == 'true'
90 runs-on: ubuntu-latest
91
92 steps:
93 - name: Checkout repository
94 uses: actions/checkout@v7
95
96 - name: Setup Node.js
97 uses: actions/setup-node@v7
98 with:
99 node-version-file: package.json
100
101 - name: Install Task
102 uses: arduino/setup-task@v3
103 with:
104 repo-token: ${{ secrets.GITHUB_TOKEN }}
105 version: 3.x
106
107 - name: Check links
108 run: task --silent markdown:check-links