Skip to content

Commit b977cf4

Browse files
authored
Improve status embed workflow (#124)
Removes redundant and incorrect condition, removes use of deprecated ::set-output, and ensures correct information is displayed in the embed
1 parent d1acc6e commit b977cf4

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

.github/workflows/status_embed.yaml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,6 @@ concurrency:
1313

1414
jobs:
1515
status_embed:
16-
# We send the embed in the following situations:
17-
# - Always after the `Build & Deploy` workflow, as it runs at the
18-
# end of our workflow sequence regardless of status.
19-
# - Always for the `pull_request` event, as it only
20-
# runs one workflow.
21-
# - Always run for non-success workflows, as they
22-
# terminate the workflow sequence.
23-
if: >-
24-
(github.event.workflow_run.name == 'Build & Deploy' && 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

@@ -42,10 +30,10 @@ jobs:
4230
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

@@ -60,7 +48,14 @@ jobs:
6048
webhook_id: '784184528997842985'
6149
webhook_token: ${{ secrets.GHA_WEBHOOK_TOKEN }}
6250

51+
# We need to provide the information of the workflow that
52+
# triggered this workflow instead of this workflow.
53+
workflow_name: ${{ github.event.workflow_run.name }}
54+
run_id: ${{ github.event.workflow_run.id }}
55+
run_number: ${{ github.event.workflow_run.run_number }}
6356
status: ${{ github.event.workflow_run.conclusion }}
57+
sha: ${{ github.event.workflow_run.head_sha }}
58+
6459
pr_author_login: ${{ steps.pr_info.outputs.pr_author_login }}
6560
pr_number: ${{ steps.pr_info.outputs.pr_number }}
6661
pr_title: ${{ steps.pr_info.outputs.pr_title }}

0 commit comments

Comments
 (0)