From 2033662895fec9cab0d5e1ca03b564530f557fc4 Mon Sep 17 00:00:00 2001 From: plsgivemeachane <100744636+plsgivemeachane@users.noreply.github.com> Date: Sun, 8 Oct 2023 06:34:37 +0700 Subject: [PATCH] Create main.yml --- .github/workflows/main.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..55a56fd --- /dev/null +++ b/.github/workflows/main.yml @@ -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 }}).'