Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
PranshulGG committed Nov 20, 2024
2 parents d1700bc + 0490724 commit 20f8717
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/discord.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Send Commit Messages to Discord

on:
push:
branches:
Expand All @@ -13,6 +13,13 @@ jobs:
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
LAST_COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s')
LAST_COMMIT_AUTHOR=$(git log -1 --pretty=format:'%an')
REPO_NAME=${{ github.repository }}
ACTOR=${{ github.actor }}
BRANCH=${{ github.ref_name }}
curl -X POST -H "Content-Type: application/json" \
-d "{\"content\": \"New push to ${GITHUB_REPOSITORY} by ${GITHUB_ACTOR}: ${GITHUB_EVENT_NAME}\"}" \
-d "{
\"content\": \"${LAST_COMMIT_AUTHOR} pushed to ${REPO_NAME} on branch ${BRANCH}: ${LAST_COMMIT_MESSAGE}\"
}" \
$DISCORD_WEBHOOK

0 comments on commit 20f8717

Please sign in to comment.