Skip to content

Commit 67d8825

Browse files
authored
Merge branch 'main' into main
2 parents 9aaddcf + 3a810f4 commit 67d8825

File tree

2 files changed

+47
-11
lines changed

2 files changed

+47
-11
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# .github/actions/set-commit-status/action.yml
2+
name: 'Set Commit Status'
3+
description: 'Sets the commit status for a given SHA'
4+
inputs:
5+
sha:
6+
description: 'The commit SHA to update the status for'
7+
required: true
8+
status:
9+
description: 'The status to set (pending, success, failure, error)'
10+
default: ${{ job.status }}
11+
context:
12+
description: 'The context for the status check'
13+
default: '${{ github.workflow }} / ${{ github.job }} (${{ github.event.workflow_run.event }})'
14+
description:
15+
description: 'A short description of the status'
16+
default: ${{ job.status }}
17+
token:
18+
description: 'GitHub token'
19+
default: ${{ github.token }}
20+
runs:
21+
using: 'composite'
22+
steps:
23+
- name: Set commit status
24+
uses: myrotvorets/set-commit-status-action@v2.0.1
25+
with:
26+
sha: ${{ inputs.sha }}
27+
token: ${{ inputs.token }}
28+
status: ${{ inputs.status }}
29+
context: ${{ inputs.context }}
30+
description: ${{ inputs.description }}

.github/workflows/deploy-prod.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ jobs:
1414
- name: Checkout repository
1515
uses: actions/checkout@v4
1616

17+
- name: Attach run to the commit
18+
uses: ./.github/actions/set-commit-status
19+
with:
20+
sha: ${{ github.event.workflow_run.head_sha }}
21+
1722
- name: Download pages
1823
uses: actions/download-artifact@v4
1924
with:
@@ -44,20 +49,24 @@ jobs:
4449
projectId: cp-algorithms
4550
channelId: live
4651

52+
- name: Set final commit status
53+
uses: ./.github/actions/set-commit-status
54+
if: always()
55+
with:
56+
sha: ${{ github.event.workflow_run.head_sha }}
57+
4758
deploy_github_pages:
4859
runs-on: ubuntu-latest
4960
if: github.event.workflow_run.conclusion == 'success'
5061
steps:
51-
- name: Set commit status as pending
52-
uses: myrotvorets/set-commit-status-action@v2.0.1
53-
with:
54-
sha: ${{ github.event.workflow_run.head_sha }}
55-
token: ${{ github.token }}
56-
description: ${{ job.status }}
57-
5862
- name: Checkout repository
5963
uses: actions/checkout@v4
6064

65+
- name: Attach run to the commit
66+
uses: ./.github/actions/set-commit-status
67+
with:
68+
sha: ${{ github.event.workflow_run.head_sha }}
69+
6170
- name: Download pages
6271
uses: actions/download-artifact@v4
6372
with:
@@ -80,10 +89,7 @@ jobs:
8089
full_commit_message: "Preview for ${{ steps.get-pr-number.outputs.pr_number != 'main' && '#' || '' }}${{ steps.get-pr-number.outputs.pr_number }} (${{ github.event.workflow_run.head_sha }}) at https://gh.cp-algorithms.com/${{ steps.get-pr-number.outputs.pr_number }}/"
8190

8291
- name: Set final commit status
83-
uses: myrotvorets/set-commit-status-action@v2.0.1
92+
uses: ./.github/actions/set-commit-status
8493
if: always()
8594
with:
8695
sha: ${{ github.event.workflow_run.head_sha }}
87-
token: ${{ github.token }}
88-
status: ${{ job.status }}
89-
description: ${{ job.status }}

0 commit comments

Comments
 (0)