File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Notify Discord on Push
2+
3+ on :
4+ push :
5+
6+ jobs :
7+ notify-discord :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - name : Checkout code
11+ uses : actions/checkout@v3
12+
13+ - name : Get last commit info
14+ id : commit
15+ run : |
16+ echo "msg=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
17+ echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
18+ echo "full_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
19+
20+ - name : Send Discord Notification
21+ env :
22+ DISCORD_WEBHOOK_URL : ${{ secrets.DISCORD_WEBHOOK_URL }}
23+ run : |
24+ curl -H "Content-Type: application/json" \
25+ -X POST \
26+ -d "{\"content\": \"[\`${{ steps.commit.outputs.sha }}\`](https://github.com/${{ github.repository }}/commit/${{ steps.commit.outputs.full_sha }}) [Commit] **${{ steps.commit.outputs.msg }}** by @${{ github.actor }}\"}" \
27+ "$DISCORD_WEBHOOK_URL"
You can’t perform that action at this time.
0 commit comments