Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate Discord notification steps #4088

Merged
merged 1 commit into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,25 +188,14 @@ jobs:
./build docker-metadata --configuration=Release --exclusive

notify-discord:
runs-on: ubuntu-latest
needs:
- upload-deb
- upload-rpm
- upload-inflator
- upload-metadata-tester
env:
JOB_STATUS: failure
if: always()
steps:
- name: Set Success
run: echo "JOB_STATUS=success" >> $GITHUB_ENV
if: contains(needs.*.result, 'failure') == false
- name: Send Discord Notification
env:
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
HOOK_OS_NAME: ${{ runner.os }}
WORKFLOW_NAME: ${{ github.workflow }}
if: env.WEBHOOK_URL
run: |
git clone --depth 1 https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
uses: ./.github/workflows/notify.yml
with:
name: ${{ github.workflow }}
success: ${{ !contains(needs.*.result, 'failure') }}
secrets: inherit
26 changes: 26 additions & 0 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Send Discord Notification

on:
workflow_call:
inputs:
name:
type: string
required: true
success:
type: boolean
required: true
secrets:
DISCORD_WEBHOOK:
required: true

jobs:
notify:
runs-on: ubuntu-latest
steps:
- env:
WORKFLOW_NAME: ${{ inputs.name }}
HOOK_OS_NAME: ${{ runner.os }}
shell: bash
run: |
git clone --depth 1 https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh ${{ inputs.success && 'success' || 'failure' }} ${{ secrets.DISCORD_WEBHOOK }}
21 changes: 5 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,26 +181,15 @@ jobs:
run: gh release upload ${{ github.event.release.tag_name }} _build/repack/Release/AutoUpdater.exe

notify-discord:
runs-on: ubuntu-latest
needs:
- build-dmg
- build-deb
- build-rpm
- upload-binaries
- upload-nuget
env:
JOB_STATUS: failure
if: always()
steps:
- name: Set Success
run: echo "JOB_STATUS=success" >> $GITHUB_ENV
if: contains(needs.*.result, 'failure') == false
- name: Send Discord Notification
env:
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
HOOK_OS_NAME: ${{ runner.os }}
WORKFLOW_NAME: ${{ github.workflow }}
if: env.WEBHOOK_URL
run: |
git clone --depth 1 https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
uses: ./.github/workflows/notify.yml
with:
name: ${{ github.workflow }}
success: ${{ !contains(needs.*.result, 'failure') }}
secrets: inherit
19 changes: 6 additions & 13 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,11 @@ jobs:
"
notify:
needs:
- build-release
- smoke-test-inflator
runs-on: ubuntu-latest
if: failure()
steps:
- name: Send Discord Notification
env:
JOB_STATUS: failure
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
HOOK_OS_NAME: ${{ runner.os }}
WORKFLOW_NAME: ${{ github.workflow }}
if: env.WEBHOOK_URL
run: |
git clone https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
shell: bash
uses: ./.github/workflows/notify.yml
with:
name: ${{ github.workflow }}
success: ${{ !contains(needs.*.result, 'failure') }}
secrets: inherit
19 changes: 6 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,11 @@ jobs:

notify:
needs:
- build-debug
- test-build
runs-on: ubuntu-latest
if: failure()
steps:
- name: Send Discord Notification
env:
JOB_STATUS: failure
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
HOOK_OS_NAME: ${{ runner.os }}
WORKFLOW_NAME: ${{ github.workflow }}
if: env.WEBHOOK_URL
run: |
git clone https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
shell: bash
uses: ./.github/workflows/notify.yml
with:
name: ${{ github.workflow }}
success: ${{ !contains(needs.*.result, 'failure') }}
secrets: inherit