88 ref :
99 required : true
1010 type : string
11- default : release/v5
11+ default : release/v6
1212 workflow_call :
1313 inputs :
1414 ref :
2727 run :
2828 shell : bash
2929 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/checks-action@v1.6.0
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 }}
7330 - name : Checkout
7431 uses : actions/checkout@v3
7532 with :
@@ -78,13 +35,20 @@ jobs:
7835 run : |
7936 git config --global user.email "npm-cli+bot@github.com"
8037 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 }}
8146 - name : Setup Node
8247 uses : actions/setup-node@v3
8348 id : node
8449 with :
8550 node-version : 20.x
8651 check-latest : contains('20.x', '.x')
87-
8852 - name : Remove Template-OSS
8953 if : matrix && matrix.node-version == '6.17.1'
9054 run : |
@@ -100,11 +64,11 @@ jobs:
10064 run : npm run postlint --ignore-scripts
10165 - name : Conclude Check
10266 uses : LouisBrunner/checks-action@v1.6.0
103- if : steps.check.outputs.check_id && always()
67+ if : always()
10468 with :
10569 token : ${{ secrets.GITHUB_TOKEN }}
10670 conclusion : ${{ job.status }}
107- check_id : ${{ steps.check.outputs.check_id }}
71+ check_id : ${{ steps.create- check.outputs.check-id }}
10872
10973 test-all :
11074 name : Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
@@ -124,49 +88,6 @@ jobs:
12488 run :
12589 shell : ${{ matrix.platform.shell }}
12690 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/checks-action@v1.6.0
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 }}
17091 - name : Checkout
17192 uses : actions/checkout@v3
17293 with :
@@ -175,13 +96,20 @@ jobs:
17596 run : |
17697 git config --global user.email "npm-cli+bot@github.com"
17798 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 }}
178107 - name : Setup Node
179108 uses : actions/setup-node@v3
180109 id : node
181110 with :
182111 node-version : ${{ matrix.node-version }}
183112 check-latest : contains(matrix.node-version, '.x')
184-
185113 - name : Remove Template-OSS
186114 if : matrix && matrix.node-version == '6.17.1'
187115 run : |
@@ -197,8 +125,8 @@ jobs:
197125 run : npm test --ignore-scripts
198126 - name : Conclude Check
199127 uses : LouisBrunner/checks-action@v1.6.0
200- if : steps.check.outputs.check_id && always()
128+ if : always()
201129 with :
202130 token : ${{ secrets.GITHUB_TOKEN }}
203131 conclusion : ${{ job.status }}
204- check_id : ${{ steps.check.outputs.check_id }}
132+ check_id : ${{ steps.create- check.outputs.check-id }}
0 commit comments