Skip to content

update workflow

update workflow #4

Workflow file for this run

name: Discord Notification
on:
push:
branches:
- main
jobs:
discordNotification:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set commit message
id: commit
run: echo "::set-output name=message::$(git log --format=%B -n 1 $GITHUB_SHA)"
- name: Set changed files
id: files
run: echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r $GITHUB_SHA)"
- name: Send Discord notification
run: |
curl -X POST -H "Content-Type: application/json" \
-d '{
"content": "New push event occurred in the repository.",
"username": "GitHub",
"avatar_url": "https://example.com/avatar.png",
"embeds": [
{
"title": "Git Push Details",
"description": "Operator: ${{ github.actor }}\nTime: $(date)\nGit Commit Hash: ${{ github.sha }}\nContent: ${{ steps.commit.outputs.message }}\nChanged Files: ${{ steps.files.outputs.files }}",
"color": 16777215
}
]
}' \
${{ secrets.DISCORD_WEBHOOK_URL }}