Skip to content

Commit b1cd600

Browse files
committed
.github/workflows/01-make-dist.yml: PoC with LouisBrunner/checks-action to change the action/check entry itself (as alternative to PR/commit comments) [networkupstools#1400]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent 3c7a8b1 commit b1cd600

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/01-make-dist.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ on:
2626
# Allow manually running the action, e.g. if disabled after some quietness in the source
2727

2828
permissions:
29+
checks: write
2930
contents: write
3031
issues: write
3132
pull-requests: write
@@ -43,6 +44,47 @@ jobs:
4344
fail-fast: false
4445

4546
steps:
47+
# PoC, see https://github.com/LouisBrunner/checks-action
48+
# and https://powgs.freetls.fastly.net/mirror/misskey/-/blob/develop/.github/workflows/pr-preview-deploy.yml
49+
# and e.g. https://api.github.com/repos/networkupstools/nut/commits/973fb587ebcf904bcfff869c3577e91cbb03e708/check-runs
50+
- uses: actions/github-script@v6.3.3
51+
id: job-check-id
52+
env:
53+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
54+
job: "Make Dist and Docs Tarballs"
55+
### This gives "make-dist-tarballs":
56+
job_id: ${{ github.job }}
57+
run_id: ${{ github.run_id }}
58+
with:
59+
github-token: ${{ secrets.GITHUB_TOKEN }}
60+
result-encoding: string
61+
script: |
62+
const ref = process.env.ref;
63+
const { data: checks } = await github.rest.checks.listForRef({
64+
...context.repo,
65+
ref
66+
});
67+
68+
const check = checks.check_runs.filter(c => c.name === process.env.job);
69+
70+
return check[0].id;
71+
72+
73+
- name: "GHA-01: Change this GH Check report"
74+
uses: LouisBrunner/checks-action@v2.0.0
75+
if: always()
76+
#continue-on-error: true
77+
env:
78+
check_id: ${{ steps.job-check-id.outputs.result }}
79+
with:
80+
token: ${{ secrets.GITHUB_TOKEN }}
81+
check_id: ${{ env.check_id }}
82+
#check_id: ${{ github.run_id }}
83+
#name: "GHA-01: Make dist and docs tarballs, see workflow page for links"
84+
status: "in_progress"
85+
details_url: http://localhost
86+
output: '{ "text_description": "Dist and Docs tarballs will be linked here after the `make dist` job completes", "summary": "in_progress"}'
87+
4688
# Post early so this would be about the top comment in the PR trail
4789
# (easy to see, contents replaced later)
4890
- name: "GHA-01: Make dist and docs tarballs - report download URL (placeholder) as a first-ever PR comment"

0 commit comments

Comments
 (0)