27
27
run :
28
28
shell : bash
29
29
steps :
30
- - name : Get Workflow Job
31
- uses : actions/github-script@v6
32
- if : inputs.check-sha
33
- id : check-output
34
- env :
35
- JOB_NAME : " Lint All"
36
- MATRIX_NAME : " "
37
- with :
38
- script : |
39
- const { owner, repo } = context.repo
40
-
41
- const { data } = await github.rest.actions.listJobsForWorkflowRun({
42
- owner,
43
- repo,
44
- run_id: context.runId,
45
- per_page: 100
46
- })
47
-
48
- const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME
49
- const job = data.jobs.find(j => j.name.endsWith(jobName))
50
- const jobUrl = job?.html_url
51
-
52
- const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}`
53
-
54
- let summary = `This check is assosciated with ${shaUrl}\n\n`
55
-
56
- if (jobUrl) {
57
- summary += `For run logs, click here: ${jobUrl}`
58
- } else {
59
- summary += `Run logs could not be found for a job with name: "${jobName}"`
60
- }
61
-
62
- return { summary }
63
- - name : Create Check
64
- uses :
LouisBrunner/[email protected]
65
- id : check
66
- if : inputs.check-sha
67
- with :
68
- token : ${{ secrets.GITHUB_TOKEN }}
69
- status : in_progress
70
- name : Lint All
71
- sha : ${{ inputs.check-sha }}
72
- output : ${{ steps.check-output.outputs.result }}
73
30
- name : Checkout
74
31
uses : actions/checkout@v3
75
32
with :
@@ -78,13 +35,20 @@ jobs:
78
35
run : |
79
36
git config --global user.email "[email protected] "
80
37
git config --global user.name "npm CLI robot"
38
+ - name : Create Check
39
+ id : create-check
40
+ if : ${{ inputs.check-sha }}
41
+ uses : ./.github/actions/create-check
42
+ with :
43
+ name : " Lint All"
44
+ token : ${{ secrets.GITHUB_TOKEN }}
45
+ sha : ${{ inputs.check-sha }}
81
46
- name : Setup Node
82
47
uses : actions/setup-node@v3
83
48
id : node
84
49
with :
85
50
node-version : 20.x
86
51
check-latest : contains('20.x', '.x')
87
-
88
52
- name : Remove Template-OSS
89
53
if : matrix && matrix.node-version == '6.17.1'
90
54
run : |
@@ -100,11 +64,11 @@ jobs:
100
64
run : npm run postlint --ignore-scripts
101
65
- name : Conclude Check
102
66
uses :
LouisBrunner/[email protected]
103
- if : steps.check.outputs.check_id && always()
67
+ if : always()
104
68
with :
105
69
token : ${{ secrets.GITHUB_TOKEN }}
106
70
conclusion : ${{ job.status }}
107
- check_id : ${{ steps.check.outputs.check_id }}
71
+ check_id : ${{ steps.create- check.outputs.check-id }}
108
72
109
73
test-all :
110
74
name : Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
@@ -124,49 +88,6 @@ jobs:
124
88
run :
125
89
shell : ${{ matrix.platform.shell }}
126
90
steps :
127
- - name : Get Workflow Job
128
- uses : actions/github-script@v6
129
- if : inputs.check-sha
130
- id : check-output
131
- env :
132
- JOB_NAME : " Test All"
133
- MATRIX_NAME : " - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
134
- with :
135
- script : |
136
- const { owner, repo } = context.repo
137
-
138
- const { data } = await github.rest.actions.listJobsForWorkflowRun({
139
- owner,
140
- repo,
141
- run_id: context.runId,
142
- per_page: 100
143
- })
144
-
145
- const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME
146
- const job = data.jobs.find(j => j.name.endsWith(jobName))
147
- const jobUrl = job?.html_url
148
-
149
- const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}`
150
-
151
- let summary = `This check is assosciated with ${shaUrl}\n\n`
152
-
153
- if (jobUrl) {
154
- summary += `For run logs, click here: ${jobUrl}`
155
- } else {
156
- summary += `Run logs could not be found for a job with name: "${jobName}"`
157
- }
158
-
159
- return { summary }
160
- - name : Create Check
161
- uses :
LouisBrunner/[email protected]
162
- id : check
163
- if : inputs.check-sha
164
- with :
165
- token : ${{ secrets.GITHUB_TOKEN }}
166
- status : in_progress
167
- name : Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
168
- sha : ${{ inputs.check-sha }}
169
- output : ${{ steps.check-output.outputs.result }}
170
91
- name : Checkout
171
92
uses : actions/checkout@v3
172
93
with :
@@ -175,13 +96,20 @@ jobs:
175
96
run : |
176
97
git config --global user.email "[email protected] "
177
98
git config --global user.name "npm CLI robot"
99
+ - name : Create Check
100
+ id : create-check
101
+ if : ${{ inputs.check-sha }}
102
+ uses : ./.github/actions/create-check
103
+ with :
104
+ name : " Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
105
+ token : ${{ secrets.GITHUB_TOKEN }}
106
+ sha : ${{ inputs.check-sha }}
178
107
- name : Setup Node
179
108
uses : actions/setup-node@v3
180
109
id : node
181
110
with :
182
111
node-version : ${{ matrix.node-version }}
183
112
check-latest : contains(matrix.node-version, '.x')
184
-
185
113
- name : Remove Template-OSS
186
114
if : matrix && matrix.node-version == '6.17.1'
187
115
run : |
@@ -197,8 +125,8 @@ jobs:
197
125
run : npm test --ignore-scripts
198
126
- name : Conclude Check
199
127
uses :
LouisBrunner/[email protected]
200
- if : steps.check.outputs.check_id && always()
128
+ if : always()
201
129
with :
202
130
token : ${{ secrets.GITHUB_TOKEN }}
203
131
conclusion : ${{ job.status }}
204
- check_id : ${{ steps.check.outputs.check_id }}
132
+ check_id : ${{ steps.create- check.outputs.check-id }}
0 commit comments