name: Discord Push Notification on: push: branches: ['**'] jobs: notify: runs-on: ubuntu-latest steps: - name: Send Discord notification env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }} COMMIT_MSG: ${{ github.event.head_commit.message }} run: | BRANCH="${GITHUB_REF#refs/heads/}" REPO="${{ github.repository }}" AUTHOR="${{ github.event.head_commit.author.username }}" COMMIT_SHA="${{ github.sha }}" SHORT_SHA="${COMMIT_SHA:0:7}" COMMIT_URL="${{ github.event.head_commit.url }}" COMPARE_URL="${{ github.event.compare }}" COMMIT_COUNT="${{ github.event.size }}" TIMESTAMP="$(date -u +%Y-%m-%dT%H:%M:%S.000Z)" # Truncate commit message for embed FIRST_LINE=$(echo "$COMMIT_MSG" | head -n1 | cut -c1-256) curl -s -o /dev/null -w "%{http_code}" -H "Content-Type: application/json" \ -X POST "$DISCORD_WEBHOOK" \ -d @- <