From 49d469176ca8cd08916548104d2040989225d192 Mon Sep 17 00:00:00 2001 From: Amrou Date: Tue, 14 Feb 2023 15:49:00 +0100 Subject: [PATCH 1/2] add status_embed workflow --- .github/workflows/status_embed.yaml | 63 +++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/status_embed.yaml diff --git a/.github/workflows/status_embed.yaml b/.github/workflows/status_embed.yaml new file mode 100644 index 0000000..e81875b --- /dev/null +++ b/.github/workflows/status_embed.yaml @@ -0,0 +1,63 @@ +name: Status Embed + +on: + workflow_call: + inputs: + job_status: + required: true + type: string + secrets: + webhook_token: + required: true + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.sha }} + cancel-in-progress: true + +jobs: + status_embed: + # We need to send a status embed whenever the workflow + # sequence we're running terminates. There are a number + # of situations in which that happens: + # + # 1. We reach the end of the Deploy workflow, without + # it being skipped. + # + # 2. A `pull_request` triggered a Lint & Test workflow, + # as the sequence always terminates with one run. + # + # 3. If any workflow ends in failure or was cancelled. + if: >- + (github.workflow == 'Deploy' && ${{ inputs.job_status }} != 'skipped') || + github.event_name == 'pull_request' || + ${{ inputs.job_status }} == 'failure' || + ${{ inputs.job_status }} == 'cancelled' + name: Send Status Embed to Discord + runs-on: ubuntu-latest + + steps: + # Send an informational status embed to Discord instead of the + # standard embeds that Discord sends. This embed will contain + # more information and we can fine tune when we actually want + # to send an embed. + - name: GitHub Actions Status Embed for Discord + uses: SebastiaanZ/github-status-embed-for-discord@v0.2.1 + with: + # Our GitHub Actions webhook + webhook_id: '784184528997842985' + webhook_token: ${{ secrets.webhook_token }} + + # Workflow information + workflow_name: ${{ github.workflow }} + run_id: ${{ github.run_id }} + run_number: ${{ github.run_number }} + status: ${{ inputs.job_status }} + actor: ${{ github.actor }} + repository: ${{ github.repository }} + ref: ${{ github.ref }} + sha: ${{ github.sha }} + + pr_author_login: ${{ github.event.pull_request.user.login}} + pr_number: ${{ github.event.pull_request.number }} + pr_title: ${{ github.event.pull_request.title }} + pr_source: ${{ github.event.pull_request.head.label }} From a1a6292fb61ee8b6ea54c5a47b43d762fb6944bb Mon Sep 17 00:00:00 2001 From: Amrou Date: Tue, 14 Feb 2023 16:08:25 +0100 Subject: [PATCH 2/2] bump github-status-embed-for-discord from 0.2.1 to 0.3.0 --- .github/workflows/status_embed.yaml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/status_embed.yaml b/.github/workflows/status_embed.yaml index e81875b..4ca5ab0 100644 --- a/.github/workflows/status_embed.yaml +++ b/.github/workflows/status_embed.yaml @@ -41,22 +41,14 @@ jobs: # more information and we can fine tune when we actually want # to send an embed. - name: GitHub Actions Status Embed for Discord - uses: SebastiaanZ/github-status-embed-for-discord@v0.2.1 + uses: SebastiaanZ/github-status-embed-for-discord@v0.3.0 with: # Our GitHub Actions webhook webhook_id: '784184528997842985' webhook_token: ${{ secrets.webhook_token }} # Workflow information - workflow_name: ${{ github.workflow }} - run_id: ${{ github.run_id }} - run_number: ${{ github.run_number }} status: ${{ inputs.job_status }} - actor: ${{ github.actor }} - repository: ${{ github.repository }} - ref: ${{ github.ref }} - sha: ${{ github.sha }} - pr_author_login: ${{ github.event.pull_request.user.login}} pr_number: ${{ github.event.pull_request.number }} pr_title: ${{ github.event.pull_request.title }}