Skip to content

Commit 61634af

Browse files
authored
Update build.yml
1 parent a11bd84 commit 61634af

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@ jobs:
2626
# Получаем рефы для pull-реквеста
2727
ref: ${{ github.event.workflow_run.head_branch }}
2828

29+
- name: Create Check Run (Started)
30+
uses: actions/github-script@v6
31+
id: create_check_run
32+
with:
33+
script: |
34+
const { data: checkRun } = await github.rest.checks.create({
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
name: 'Build Workflow - ${{ matrix.script }}',
38+
head_sha: '${{ github.event.workflow_run.head_sha }}',
39+
status: 'in_progress',
40+
details_url: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}',
41+
output: {
42+
title: 'Build Started',
43+
summary: 'Build has started.'
44+
}
45+
});
46+
core.setOutput('check_run_id', checkRun.id);
47+
2948
- name: Set up QEMU
3049
uses: docker/setup-qemu-action@v2
3150

@@ -44,21 +63,22 @@ jobs:
4463
run: |
4564
docker run -d -p 5000:5000 --name registry registry:2
4665
./${{ matrix.script }}
47-
- name: Update PR Check Status
66+
67+
- name: Update PR Check Status (Completed)
4868
if: always()
4969
uses: actions/github-script@v6
5070
with:
5171
script: |
5272
const conclusion = '${{ job.status }}' === 'success' ? 'success' : 'failure';
53-
await github.rest.checks.create({
73+
await github.rest.checks.update({
5474
owner: context.repo.owner,
5575
repo: context.repo.repo,
56-
name: 'Build Workflow - ${{ matrix.script }}',
57-
head_sha: '${{ github.event.workflow_run.head_sha }}',
76+
check_run_id: ${{ steps.create_check_run.outputs.check_run_id }},
5877
status: 'completed',
5978
conclusion,
79+
completed_at: new Date().toISOString(),
6080
output: {
61-
title: 'Build Workflow - ${{ matrix.script }}',
81+
title: 'Build ' + (conclusion === 'success' ? 'Succeeded' : 'Failed'),
6282
summary: `Workflow for script '${{ matrix.script }}' completed with conclusion: ${conclusion}`
6383
}
6484
});

0 commit comments

Comments
 (0)