chore: readme fix #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Commit Log to Discord | |
| on: | |
| push: | |
| branches: [main, master] | |
| jobs: | |
| discord: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Extract commit info | |
| id: info | |
| run: | | |
| echo "sha_short=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT | |
| echo "msg_first=$(echo '${{ github.event.head_commit.message }}' | head -n1 | sed 's/"/\\"/g')" >> $GITHUB_OUTPUT | |
| echo "repo=${{ github.event.repository.name }}" >> $GITHUB_OUTPUT | |
| echo "ref=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
| - name: Send embed to Discord | |
| run: | | |
| JSON=$(cat <<EOF | |
| { | |
| "embeds": [{ | |
| "title": "[${{ steps.info.outputs.repo }}] ${{ steps.info.outputs.msg_first }}", | |
| "url": "https://github.com/${{ github.repository }}/commit/${{ github.sha }}", | |
| "description": "Commit \`${{ steps.info.outputs.sha_short }}\` on \`${{ steps.info.outputs.ref }}\`", | |
| "color": 5814783, | |
| "footer": { | |
| "text": "${{ steps.info.outputs.repo }}" | |
| } | |
| }] | |
| } | |
| EOF) | |
| curl -s -H "Content-Type: application/json" \ | |
| -d "$JSON" \ | |
| ${{ secrets.DISCORD_WEBHOOK_GITHUB }} |