Skip to content

Commit

Permalink
ci: test discord notification
Browse files Browse the repository at this point in the history
  • Loading branch information
hughlv committed Aug 12, 2024
1 parent 8dfc978 commit 43e19ec
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/discord-release-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ jobs:
notify_discord:
runs-on: ubuntu-latest
steps:
- name: Set test variables
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
RELEASE_TAG: "v1.0.0-test"
RELEASE_NAME: "Test Release"
RELEASE_BODY: "This is a test release."
RELEASE_URL: "https://example.com"
run: echo "Testing with release tag: $RELEASE_TAG"

- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
Expand All @@ -22,10 +31,10 @@ jobs:
- name: Send Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_ANN }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
RELEASE_NAME: ${{ github.event.release.name }}
RELEASE_BODY: ${{ github.event.release.body }}
RELEASE_URL: ${{ github.event.release.html_url }}
RELEASE_TAG: ${{ env.RELEASE_TAG || github.event.release.tag_name }}
RELEASE_NAME: ${{ env.RELEASE_NAME || github.event.release.name }}
RELEASE_BODY: ${{ env.RELEASE_BODY || github.event.release.body }}
RELEASE_URL: ${{ env.RELEASE_URL || github.event.release.html_url }}
run: |
echo "Sending notification for release: $RELEASE_TAG"
curl -H "Content-Type: application/json" -X POST -d @- $DISCORD_WEBHOOK <<EOF
Expand All @@ -37,4 +46,4 @@ jobs:
"color": 3066993
}]
}
EOF
EOF

0 comments on commit 43e19ec

Please sign in to comment.