Skip to content

Commit d85f627

Browse files
committed
Update status embed workflow
Use updated status embed workflow with various fixes and updates. This improves consistency with other repos
1 parent 8608bc3 commit d85f627

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

.github/workflows/status-embed.yml

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,12 @@ on:
77
types:
88
- completed
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
1014
jobs:
1115
status_embed:
12-
# We need to send a status embed whenever the workflow
13-
# sequence we're running terminates. There are a number
14-
# of situations in which that happens:
15-
#
16-
# 1. We reach the end of the Event Validation workflow, without
17-
# it being skipped.
18-
#
19-
# 2. A `pull_request` triggered a Lint & Test workflow,
20-
# as the sequence always terminates with one run.
21-
#
22-
# 3. If any workflow ends in failure or was cancelled.
23-
if: >-
24-
(github.event.workflow_run.name == 'Event Validation' && github.event.workflow_run.conclusion != 'skipped') ||
25-
github.event.workflow_run.event == 'pull_request' ||
26-
github.event.workflow_run.conclusion == 'failure' ||
27-
github.event.workflow_run.conclusion == 'cancelled'
2816
name: Send Status Embed to Discord
2917
runs-on: ubuntu-latest
3018

@@ -39,13 +27,13 @@ jobs:
3927
curl -s -H "Authorization: token $GITHUB_TOKEN" ${{ github.event.workflow_run.artifacts_url }} > artifacts.json
4028
DOWNLOAD_URL=$(cat artifacts.json | jq -r '.artifacts[] | select(.name == "pull-request-payload") | .archive_download_url')
4129
[ -z "$DOWNLOAD_URL" ] && exit 1
42-
wget --quiet --header="Authorization: token $GITHUB_TOKEN" -O pull_request_payload.zip $DOWNLOAD_URL || exit 2
30+
curl -sSL -H "Authorization: token $GITHUB_TOKEN" -o pull_request_payload.zip $DOWNLOAD_URL || exit 2
4331
unzip -p pull_request_payload.zip > pull_request_payload.json
4432
[ -s pull_request_payload.json ] || exit 3
45-
echo "::set-output name=pr_author_login::$(jq -r '.user.login // empty' pull_request_payload.json)"
46-
echo "::set-output name=pr_number::$(jq -r '.number // empty' pull_request_payload.json)"
47-
echo "::set-output name=pr_title::$(jq -r '.title // empty' pull_request_payload.json)"
48-
echo "::set-output name=pr_source::$(jq -r '.head.label // empty' pull_request_payload.json)"
33+
echo "pr_author_login=$(jq -r '.user.login // empty' pull_request_payload.json)" >> $GITHUB_OUTPUT
34+
echo "pr_number=$(jq -r '.number // empty' pull_request_payload.json)" >> $GITHUB_OUTPUT
35+
echo "pr_title=$(jq -r '.title // empty' pull_request_payload.json)" >> $GITHUB_OUTPUT
36+
echo "pr_source=$(jq -r '.head.label // empty' pull_request_payload.json)" >> $GITHUB_OUTPUT
4937
env:
5038
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5139

@@ -54,20 +42,18 @@ jobs:
5442
# more information and we can fine tune when we actually want
5543
# to send an embed.
5644
- name: GitHub Actions Status Embed for Discord
57-
uses: SebastiaanZ/github-status-embed-for-discord@v0.2.1
45+
uses: SebastiaanZ/github-status-embed-for-discord@v0.3.0
5846
with:
5947
# Our GitHub Actions webhook
6048
webhook_id: '784184528997842985'
6149
webhook_token: ${{ secrets.GHA_WEBHOOK_TOKEN }}
6250

63-
# Workflow information
51+
# We need to provide the information of the workflow that
52+
# triggered this workflow instead of this workflow.
6453
workflow_name: ${{ github.event.workflow_run.name }}
6554
run_id: ${{ github.event.workflow_run.id }}
6655
run_number: ${{ github.event.workflow_run.run_number }}
6756
status: ${{ github.event.workflow_run.conclusion }}
68-
actor: ${{ github.actor }}
69-
repository: ${{ github.repository }}
70-
ref: ${{ github.ref }}
7157
sha: ${{ github.event.workflow_run.head_sha }}
7258

7359
pr_author_login: ${{ steps.pr_info.outputs.pr_author_login }}

0 commit comments

Comments
 (0)