Skip to content

Commit e21d906

Browse files
committed
fixup! wip: duplicate formal to fix posting comments
1 parent 205ac03 commit e21d906

File tree

2 files changed

+75
-28
lines changed

2 files changed

+75
-28
lines changed

.github/workflows/formal.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
with:
1515
post_comment: true
1616

17-
label_formality_status:
18-
name: Add Formality Status
17+
check_formality_status:
18+
name: Check Formality Status
1919
runs-on: ubuntu-slim
2020
needs: formalities
2121
if: always()
@@ -24,8 +24,9 @@ jobs:
2424
- name: Trigger build
2525
if: needs.formalities.result == 'success'
2626
env:
27+
# Token needs actions: write
28+
TOKEN: ${{ secrets.DEFAULT_TOKEN }}
2729
BASE_REF: ${{ github.base_ref }}
28-
GH_TOKEN: ${{ secrets.DEFAULT_TOKEN }}
2930
# Workflow is running in target context, so we need to get head ref
3031
# from the event
3132
HEAD_REF: ${{ github.event.pull_request.head.ref }}
@@ -42,7 +43,7 @@ jobs:
4243
curl -L \
4344
-X POST \
4445
-H "Accept: application/vnd.github+json" \
45-
-H "Authorization: Bearer $GH_TOKEN" \
46+
-H "Authorization: Bearer $TOKEN" \
4647
-H "X-GitHub-Api-Version: 2022-11-28" \
4748
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/multi-arch-test-build.yml/dispatches" \
4849
-d "$JSON_PAYLOAD"

.github/workflows/multi-arch-test-build.yml

Lines changed: 70 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,21 @@ jobs:
9797
core.setOutput('head_sha', pr.head.sha);
9898
9999
- name: Set build status as pending
100-
uses: myrotvorets/set-commit-status-action@master
101-
with:
102-
sha: ${{ steps.get_pr_data.outputs.head_sha }}
103-
context: ${{ github.workflow }} / Build / ${{ matrix.arch }}
104-
targetUrl: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}?pr=${{ inputs.pr_number }}
105-
status: pending
100+
env:
101+
# Token needs statuses: write
102+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
API_URL: https://api.github.com/repos/${{ github.repository }}/statuses/${{ steps.get_pr_data.outputs.head_sha }}
104+
CONTEXT: ${{ github.workflow }} / Build / ${{ matrix.arch }}
105+
OUTCOME: pending
106+
TARGET_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}?pr=${{ inputs.pr_number }}
107+
run: |
108+
curl -L \
109+
-X POST \
110+
-H "Accept: application/vnd.github+json" \
111+
-H "Authorization: Bearer $TOKEN" \
112+
-H "X-GitHub-Api-Version: 2022-11-28" \
113+
"$API_URL" \
114+
-d '{"state":"'"$OUTCOME"'","target_url":"'"$TARGET_URL"'","context":"'"$CONTEXT"'"}'
106115
107116
- uses: actions/checkout@v6
108117
with:
@@ -164,12 +173,26 @@ jobs:
164173
V: s
165174

166175
- name: Set final build status
167-
uses: myrotvorets/set-commit-status-action@master
168-
with:
169-
sha: ${{ steps.get_pr_data.outputs.head_sha }}
170-
context: ${{ github.workflow }} / Build / ${{ matrix.arch }}
171-
targetUrl: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}?pr=${{ inputs.pr_number }}
172-
status: ${{ steps.build.outcome }}
176+
env:
177+
# Token needs statuses: write
178+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
179+
API_URL: https://api.github.com/repos/${{ github.repository }}/statuses/${{ steps.get_pr_data.outputs.head_sha }}
180+
CONTEXT: ${{ github.workflow }} / Build / ${{ matrix.arch }}
181+
OUTCOME: ${{ steps.build.outcome }}
182+
TARGET_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}?pr=${{ inputs.pr_number }}
183+
run: |
184+
case $OUTCOME in
185+
success) state="success" ;;
186+
*) state="failure" ;;
187+
esac
188+
189+
curl -L \
190+
-X POST \
191+
-H "Accept: application/vnd.github+json" \
192+
-H "Authorization: Bearer $TOKEN" \
193+
-H "X-GitHub-Api-Version: 2022-11-28" \
194+
"$API_URL" \
195+
-d '{"state":"'"$state"'","target_url":"'"$TARGET_URL"'","context":"'"$CONTEXT"'"}'
173196
174197
- name: Move created packages to project dir
175198
if: always()
@@ -259,12 +282,21 @@ jobs:
259282
260283
- name: Set test status as pending
261284
if: ${{ matrix.runtime_test && fromJSON(env.HAVE_PKGS) }}
262-
uses: myrotvorets/set-commit-status-action@master
263-
with:
264-
sha: ${{ steps.get_pr_data.outputs.head_sha }}
265-
context: ${{ github.workflow }} / Test / ${{ matrix.arch }}
266-
targetUrl: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}?pr=${{ inputs.pr_number }}
267-
status: pending
285+
env:
286+
# Token needs statuses: write
287+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
288+
API_URL: https://api.github.com/repos/${{ github.repository }}/statuses/${{ steps.get_pr_data.outputs.head_sha }}
289+
CONTEXT: ${{ github.workflow }} / Test / ${{ matrix.arch }}
290+
OUTCOME: pending
291+
TARGET_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}?pr=${{ inputs.pr_number }}
292+
run: |
293+
curl -L \
294+
-X POST \
295+
-H "Accept: application/vnd.github+json" \
296+
-H "Authorization: Bearer $TOKEN" \
297+
-H "X-GitHub-Api-Version: 2022-11-28" \
298+
"$API_URL" \
299+
-d '{"state":"'"$OUTCOME"'","target_url":"'"$TARGET_URL"'","context":"'"$CONTEXT"'"}'
268300
269301
- name: Register QEMU
270302
if: ${{ matrix.runtime_test && fromJSON(env.HAVE_PKGS) }}
@@ -305,9 +337,23 @@ jobs:
305337
306338
- name: Set final test status
307339
if: ${{ always() && matrix.runtime_test && steps.test.outcome != 'skipped' }}
308-
uses: myrotvorets/set-commit-status-action@master
309-
with:
310-
sha: ${{ steps.get_pr_data.outputs.head_sha }}
311-
context: ${{ github.workflow }} / Test / ${{ matrix.arch }}
312-
targetUrl: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}?pr=${{ inputs.pr_number }}
313-
status: ${{ steps.test.outcome }}
340+
env:
341+
# Token needs statuses: write
342+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
343+
API_URL: https://api.github.com/repos/${{ github.repository }}/statuses/${{ steps.get_pr_data.outputs.head_sha }}
344+
CONTEXT: ${{ github.workflow }} / Test / ${{ matrix.arch }}
345+
OUTCOME: ${{ steps.test.outcome }}
346+
TARGET_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}?pr=${{ inputs.pr_number }}
347+
run: |
348+
case $OUTCOME in
349+
success) state="success" ;;
350+
*) state="failure" ;;
351+
esac
352+
353+
curl -L \
354+
-X POST \
355+
-H "Accept: application/vnd.github+json" \
356+
-H "Authorization: Bearer $TOKEN" \
357+
-H "X-GitHub-Api-Version: 2022-11-28" \
358+
"$API_URL" \
359+
-d '{"state":"'"$state"'","target_url":"'"$TARGET_URL"'","context":"'"$CONTEXT"'"}'

0 commit comments

Comments
 (0)