1 # This file is automatically added by @npmcli/template-oss. Do not edit.
2
3 name: 'Create Check'
4 inputs:
5 name:
6 required: true
7 token:
8 required: true
9 sha:
10 required: true
11 check-name:
12 default: ''
13 outputs:
14 check-id:
15 value: ${{ steps.create-check.outputs.check_id }}
16 runs:
17 using: "composite"
18 steps:
19 - name: Get Workflow Job
20 uses: actions/github-script@v7
21 id: workflow
22 env:
23 JOB_NAME: "${{ inputs.name }}"
24 SHA: "${{ inputs.sha }}"
25 with:
26 result-encoding: string
27 script: |
28 const { repo: { owner, repo}, runId, serverUrl } = context
29 const { JOB_NAME, SHA } = process.env
30
31 const job = await github.rest.actions.listJobsForWorkflowRun({
32 owner,
33 repo,
34 run_id: runId,
35 per_page: 100
36 }).then(r => r.data.jobs.find(j => j.name.endsWith(JOB_NAME)))
37
38 return [
39 `This check is assosciated with ${serverUrl}/${owner}/${repo}/commit/${SHA}.`,
40 'Run logs:',
41 job?.html_url || `could not be found for a job ending with: "${JOB_NAME}"`,
42 ].join(' ')
43 - name: Create Check
44 uses: LouisBrunner/checks-action@v1.6.0
45 id: create-check
46 with:
47 token: ${{ inputs.token }}
48 sha: ${{ inputs.sha }}
49 status: in_progress
50 name: ${{ inputs.check-name || inputs.name }}
51 output: |
52 {"summary":"${{ steps.workflow.outputs.result }}"}