From db3d535f5584344a17f806def591316da317bdb4 Mon Sep 17 00:00:00 2001 From: Stalin <161853795+0x5t4l1n@users.noreply.github.com> Date: Sun, 3 May 2026 17:24:31 +0530 Subject: [PATCH] Create dig.yml --- .github/workflows/dig.yml | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/dig.yml diff --git a/.github/workflows/dig.yml b/.github/workflows/dig.yml new file mode 100644 index 0000000..9782a48 --- /dev/null +++ b/.github/workflows/dig.yml @@ -0,0 +1,48 @@ +name: Discord Commit Notification + +on: + push: + branches: + - '**' + +jobs: + notify: + runs-on: ubuntu-latest + + steps: + - name: Send Discord notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + COMMIT_MESSAGE: ${{ github.event.head_commit.message }} + AUTHOR: ${{ github.event.head_commit.author.name }} + run: | + COMMIT_SHA="${{ github.sha }}" + SHORT_SHA="${COMMIT_SHA:0:7}" + BRANCH="${{ github.ref_name }}" + REPO="${{ github.repository }}" + COMMIT_URL="https://github.com/${REPO}/commit/${COMMIT_SHA}" + + PAYLOAD=$(jq -n \ + --arg title "New Commit in \`${REPO}\`" \ + --arg url "$COMMIT_URL" \ + --arg author "$AUTHOR" \ + --arg branch "\`${BRANCH}\`" \ + --arg commit "[\`${SHORT_SHA}\`](${COMMIT_URL})" \ + --arg message "$COMMIT_MESSAGE" \ + '{ + embeds: [{ + title: $title, + url: $url, + color: 5814783, + fields: [ + {name: "Author", value: $author, inline: true}, + {name: "Branch", value: $branch, inline: true}, + {name: "Commit", value: $commit, inline: true}, + {name: "Message", value: $message} + ] + }] + }') + + curl -sf -X POST "$DISCORD_WEBHOOK" \ + -H "Content-Type: application/json" \ + -d "$PAYLOAD"