26
26
# Получаем рефы для pull-реквеста
27
27
ref : ${{ github.event.workflow_run.head_branch }}
28
28
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
+
29
48
- name : Set up QEMU
30
49
uses : docker/setup-qemu-action@v2
31
50
@@ -44,21 +63,22 @@ jobs:
44
63
run : |
45
64
docker run -d -p 5000:5000 --name registry registry:2
46
65
./${{ matrix.script }}
47
- - name : Update PR Check Status
66
+
67
+ - name : Update PR Check Status (Completed)
48
68
if : always()
49
69
uses : actions/github-script@v6
50
70
with :
51
71
script : |
52
72
const conclusion = '${{ job.status }}' === 'success' ? 'success' : 'failure';
53
- await github.rest.checks.create ({
73
+ await github.rest.checks.update ({
54
74
owner: context.repo.owner,
55
75
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 }},
58
77
status: 'completed',
59
78
conclusion,
79
+ completed_at: new Date().toISOString(),
60
80
output: {
61
- title: 'Build Workflow - ${{ matrix.script }}' ,
81
+ title: 'Build ' + (conclusion === 'success' ? 'Succeeded' : 'Failed') ,
62
82
summary: `Workflow for script '${{ matrix.script }}' completed with conclusion: ${conclusion}`
63
83
}
64
84
});
0 commit comments