@@ -4,13 +4,18 @@ name: Check Markdown
4
4
env :
5
5
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
6
6
GO_VERSION : " 1.18"
7
+ # See: https://github.com/actions/setup-node/#readme
8
+ NODE_VERSION : 16.x
7
9
8
- # See: https://docs.github.com/en/ actions/reference /events-that-trigger-workflows
10
+ # See: https://docs.github.com/actions/using-workflows /events-that-trigger-workflows
9
11
on :
12
+ create :
10
13
push :
11
14
paths :
12
15
- " .github/workflows/check-markdown-task.ya?ml"
13
16
- " .markdown-link-check.json"
17
+ - " package.json"
18
+ - " package-lock.json"
14
19
- " Taskfile.ya?ml"
15
20
- " **/.markdownlint*"
16
21
- " **.mdx?"
21
26
paths :
22
27
- " .github/workflows/check-markdown-task.ya?ml"
23
28
- " .markdown-link-check.json"
29
+ - " package.json"
30
+ - " package-lock.json"
24
31
- " Taskfile.ya?ml"
25
32
- " **/.markdownlint*"
26
33
- " **.mdx?"
34
41
repository_dispatch :
35
42
36
43
jobs :
44
+ run-determination :
45
+ runs-on : ubuntu-latest
46
+ permissions : {}
47
+ outputs :
48
+ result : ${{ steps.determination.outputs.result }}
49
+ steps :
50
+ - name : Determine if the rest of the workflow should run
51
+ id : determination
52
+ run : |
53
+ RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
54
+ # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
55
+ if [[
56
+ "${{ github.event_name }}" != "create" ||
57
+ "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
58
+ ]]; then
59
+ # Run the other jobs.
60
+ RESULT="true"
61
+ else
62
+ # There is no need to run the other jobs.
63
+ RESULT="false"
64
+ fi
65
+
66
+ echo "result=$RESULT" >> $GITHUB_OUTPUT
67
+
37
68
lint :
69
+ needs : run-determination
70
+ if : needs.run-determination.outputs.result == 'true'
38
71
runs-on : ubuntu-latest
72
+ permissions :
73
+ contents : read
39
74
40
75
steps :
41
76
- name : Checkout repository
42
77
uses : actions/checkout@v4
43
78
79
+ - name : Setup Node.js
80
+ uses : actions/setup-node@v4
81
+ with :
82
+ node-version : ${{ env.NODE_VERSION }}
83
+
44
84
- name : Initialize markdownlint-cli problem matcher
45
- uses : xt0rted/markdownlint-problem-matcher@v2
85
+ uses : xt0rted/markdownlint-problem-matcher@v3
46
86
47
87
- name : Install Task
48
- uses : arduino/setup-task@v1
88
+ uses : arduino/setup-task@v2
49
89
with :
50
90
repo-token : ${{ secrets.GITHUB_TOKEN }}
51
91
version : 3.x
54
94
run : task markdown:lint
55
95
56
96
links :
97
+ needs : run-determination
98
+ if : needs.run-determination.outputs.result == 'true'
57
99
runs-on : ubuntu-latest
100
+ permissions :
101
+ contents : read
58
102
59
103
steps :
60
104
- name : Checkout repository
@@ -65,8 +109,13 @@ jobs:
65
109
with :
66
110
go-version : ${{ env.GO_VERSION }}
67
111
112
+ - name : Setup Node.js
113
+ uses : actions/setup-node@v4
114
+ with :
115
+ node-version : ${{ env.NODE_VERSION }}
116
+
68
117
- name : Install Task
69
- uses : arduino/setup-task@v1
118
+ uses : arduino/setup-task@v2
70
119
with :
71
120
repo-token : ${{ secrets.GITHUB_TOKEN }}
72
121
version : 3.x
0 commit comments