diff options
author | 2020-12-07 08:08:05 -0500 | |
---|---|---|
committer | 2020-12-07 08:08:05 -0500 | |
commit | f29bedfc212e6fc3c33e4839c7c7fa697e4b6b84 (patch) | |
tree | 1c4e282fa771c6f8d02e781650c9d6bec8a0794f | |
parent | Merge pull request #543 from python-discord/update-approval-policies (diff) | |
parent | Merge branch 'master' into sebastiaan/ci/status-embeds (diff) |
Merge pull request #542 from python-discord/sebastiaan/ci/status-embeds
Use custom status embeds for workflow runs
-rw-r--r-- | .github/workflows/build.yaml | 31 | ||||
-rw-r--r-- | .github/workflows/lint.yaml | 32 |
2 files changed, 63 insertions, 0 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b0c03139..64c272cf 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -75,3 +75,34 @@ jobs: kubernetes/sir-lancebot/deployment.yaml images: 'ghcr.io/python-discord/sir-lancebot:${{ steps.sha_tag.outputs.tag }}' kubectl-version: 'latest' + + # 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 + # This is the last step in the lint-build sequence, so always send + # an embed, regardless of success, failure or cancelled status. + if: always() + uses: SebastiaanZ/[email protected] + with: + # Our GitHub Actions webhook + webhook_id: '784184528997842985' + webhook_token: ${{ secrets.GHA_WEBHOOK_TOKEN }} + + # Workflow information + workflow_name: ${{ github.workflow }} + run_id: ${{ github.run_id }} + run_number: ${{ github.run_number }} + status: ${{ job.status }} + actor: ${{ github.actor }} + repository: ${{ github.repository }} + ref: ${{ github.ref }} + sha: ${{ github.sha }} + + # Optional PR-information. These values will be "null" if + # the event trigger was not PR-related. + 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 }} diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 063f406c..8dd93773 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -91,3 +91,35 @@ jobs: - name: Run flake8 run: "flake8 \ --format='::error file=%(path)s,line=%(row)d,col=%(col)d::[flake8] %(code)s: %(text)s'" + + # 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 + # For a `pull_request` we always want to send a status embed + # here. For a push event, only when this workflow is the last + # in lint->build sequence because it failed or was cancelled. + if: github.event_name == 'pull_request' || cancelled() || failure() + uses: SebastiaanZ/[email protected] + with: + # Our GitHub Actions webhook + webhook_id: '784184528997842985' + webhook_token: ${{ secrets.GHA_WEBHOOK_TOKEN }} + + # Workflow information + workflow_name: ${{ github.workflow }} + run_id: ${{ github.run_id }} + run_number: ${{ github.run_number }} + status: ${{ job.status }} + actor: ${{ github.actor }} + repository: ${{ github.repository }} + ref: ${{ github.ref }} + sha: ${{ github.sha }} + + # Optional PR-information. These values will be "null" if + # the event trigger was not PR-related. + 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 }} |