Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
plsgivemeachane authored Oct 7, 2023
1 parent c1626ef commit 2033662
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Discord Notification

on:
push:
branches:
- main

jobs:
discord:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get commit details
id: get_commit
run: |
echo "::set-output name=message::$(git log -1 --pretty=format:"%s")"
echo "::set-output name=committer::$(git log -1 --pretty=format:"%cn")"
echo "::set-output name=url::https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
- name: Send Discord notification
uses: appleboy/discord-action@master
with:
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
color: '16711680'
username: 'GitHub Actions Bot'
message: 'New commit on the main branch: "${{ steps.get_commit.outputs.message }}" by ${{ steps.get_commit.outputs.committer }}. [Check it out](${{ steps.get_commit.outputs.url }}).'

0 comments on commit 2033662

Please sign in to comment.