@@ -27,68 +27,28 @@ jobs:
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
74- uses : actions/checkout@v3
31+ uses : actions/checkout@v4
7532 with :
7633 ref : ${{ inputs.ref }}
7734 - name : Setup Git User
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
82- uses : actions/setup-node@v3
47+ uses : actions/setup-node@v4
48+ id : node
8349 with :
84- node-version : 18.x
85- - name : Remove Template-OSS
86- if : matrix && matrix.node-version == '6.17.1'
87- run : |
88- # template-oss cannot be installed on older npms because there are transient deps
89- # that use "npm:" aliases which are not supported
90- jq 'del(.devDependencies["@npmcli/template-oss"])' package.json > package.json-update
91- mv package.json-update package.json
50+ node-version : 22.x
51+ check-latest : contains('22.x', '.x')
9252 - name : Install Dependencies
9353 run : npm i --ignore-scripts --no-audit --no-fund
9454 - name : Lint
@@ -97,11 +57,11 @@ jobs:
9757 run : npm run postlint --ignore-scripts
9858 - name : Conclude Check
9959 uses : LouisBrunner/checks-action@v1.6.0
100- if : steps.check.outputs.check_id && always()
60+ if : always()
10161 with :
10262 token : ${{ secrets.GITHUB_TOKEN }}
10363 conclusion : ${{ job.status }}
104- check_id : ${{ steps.check.outputs.check_id }}
64+ check_id : ${{ steps.create- check.outputs.check-id }}
10565
10666 test-all :
10767 name : Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
@@ -115,74 +75,34 @@ jobs:
11575 shell : bash
11676 node-version :
11777 - 6.17.1
118- - 18 .x
78+ - 22 .x
11979 runs-on : ${{ matrix.platform.os }}
12080 defaults :
12181 run :
12282 shell : ${{ matrix.platform.shell }}
12383 steps :
124- - name : Get Workflow Job
125- uses : actions/github-script@v6
126- if : inputs.check-sha
127- id : check-output
128- env :
129- JOB_NAME : " Test All"
130- MATRIX_NAME : " - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
131- with :
132- script : |
133- const { owner, repo } = context.repo
134-
135- const { data } = await github.rest.actions.listJobsForWorkflowRun({
136- owner,
137- repo,
138- run_id: context.runId,
139- per_page: 100
140- })
141-
142- const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME
143- const job = data.jobs.find(j => j.name.endsWith(jobName))
144- const jobUrl = job?.html_url
145-
146- const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}`
147-
148- let summary = `This check is assosciated with ${shaUrl}\n\n`
149-
150- if (jobUrl) {
151- summary += `For run logs, click here: ${jobUrl}`
152- } else {
153- summary += `Run logs could not be found for a job with name: "${jobName}"`
154- }
155-
156- return { summary }
157- - name : Create Check
158- uses : LouisBrunner/checks-action@v1.6.0
159- id : check
160- if : inputs.check-sha
161- with :
162- token : ${{ secrets.GITHUB_TOKEN }}
163- status : in_progress
164- name : Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
165- sha : ${{ inputs.check-sha }}
166- output : ${{ steps.check-output.outputs.result }}
16784 - name : Checkout
168- uses : actions/checkout@v3
85+ uses : actions/checkout@v4
16986 with :
17087 ref : ${{ inputs.ref }}
17188 - name : Setup Git User
17289 run : |
17390 git config --global user.email "npm-cli+bot@github.com"
17491 git config --global user.name "npm CLI robot"
92+ - name : Create Check
93+ id : create-check
94+ if : ${{ inputs.check-sha }}
95+ uses : ./.github/actions/create-check
96+ with :
97+ name : " Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
98+ token : ${{ secrets.GITHUB_TOKEN }}
99+ sha : ${{ inputs.check-sha }}
175100 - name : Setup Node
176- uses : actions/setup-node@v3
101+ uses : actions/setup-node@v4
102+ id : node
177103 with :
178104 node-version : ${{ matrix.node-version }}
179- - name : Remove Template-OSS
180- if : matrix && matrix.node-version == '6.17.1'
181- run : |
182- # template-oss cannot be installed on older npms because there are transient deps
183- # that use "npm:" aliases which are not supported
184- jq 'del(.devDependencies["@npmcli/template-oss"])' package.json > package.json-update
185- mv package.json-update package.json
105+ check-latest : contains(matrix.node-version, '.x')
186106 - name : Install Dependencies
187107 run : npm i --ignore-scripts --no-audit --no-fund
188108 - name : Add Problem Matcher
@@ -191,8 +111,8 @@ jobs:
191111 run : npm test --ignore-scripts
192112 - name : Conclude Check
193113 uses : LouisBrunner/checks-action@v1.6.0
194- if : steps.check.outputs.check_id && always()
114+ if : always()
195115 with :
196116 token : ${{ secrets.GITHUB_TOKEN }}
197117 conclusion : ${{ job.status }}
198- check_id : ${{ steps.check.outputs.check_id }}
118+ check_id : ${{ steps.create- check.outputs.check-id }}
0 commit comments