|
| 1 | +name: Discord Notifications |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' # Notify for all branches |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - '**' # Notify for all PRs |
| 10 | + workflow_run: |
| 11 | + workflows: ['Generic CI', 'Godot CI', 'Build, Release and Deploy'] |
| 12 | + types: |
| 13 | + - completed |
| 14 | + |
| 15 | +jobs: |
| 16 | + notify-on-push: |
| 17 | + name: Notify on Push |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Notify Discord about Commit |
| 21 | + uses: tsickert/discord-webhook@v6.0.0 |
| 22 | + with: |
| 23 | + webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} |
| 24 | + embed-title: '🚀 New Commit Pushed!' |
| 25 | + embed-description: | |
| 26 | + **Commit Message:** ${{ github.event.head_commit.message }} |
| 27 | + **Branch:** ${{ github.ref_name }} |
| 28 | + **Author:** ${{ github.actor }} |
| 29 | + [View Commit](${{ github.event.head_commit.url }}) |
| 30 | + embed-color: 3066993 # Blue |
| 31 | + |
| 32 | + notify-on-completion: |
| 33 | + name: Notify on Workflow Completion |
| 34 | + runs-on: ubuntu-latest |
| 35 | + if: ${{ always() }} # Runs whether the workflow succeeds or fails |
| 36 | + steps: |
| 37 | + - name: Notify Discord about Workflow Status |
| 38 | + uses: tsickert/discord-webhook@v6.0.0 |
| 39 | + with: |
| 40 | + webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} |
| 41 | + embed-title: 'Status: ${{ job.status }} for ${{ github.workflow }}' |
| 42 | + embed-description: | |
| 43 | + **Repository:** ${{ github.repository }} |
| 44 | + **Branch:** ${{ github.ref_name }} |
| 45 | + **Triggered by:** ${{ github.actor }} |
| 46 | + embed-color: ${{ job.status == 'success' && 3066993 || 15158332 }} # Green for success, Red for failure |
| 47 | + |
| 48 | + notify-on-failure: |
| 49 | + name: Notify on Failure |
| 50 | + runs-on: ubuntu-latest |
| 51 | + if: ${{ failure() }} |
| 52 | + steps: |
| 53 | + - name: Notify Discord about Failure |
| 54 | + uses: tsickert/discord-webhook@v6.0.0 |
| 55 | + with: |
| 56 | + webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} |
| 57 | + embed-title: '🚨 Workflow Failed!' |
| 58 | + embed-description: | |
| 59 | + **Workflow:** ${{ github.workflow }} |
| 60 | + **Branch:** ${{ github.ref_name }} |
| 61 | + **Failed Job:** ${{ github.job }} |
| 62 | + **Triggered by:** ${{ github.actor }} |
| 63 | + embed-color: 15158332 # Red |
0 commit comments