Skip to content

Commit e94ec95

Browse files
authored
Add Workflow Discord webhook (lambda-client#109)
* update workflow * Attempt 2 * Attempt 3 * Attempt 4
1 parent 92a3a0e commit e94ec95

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/gradle_build.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on :
88
jobs :
99
build :
1010
runs-on : ubuntu-latest
11+
env:
12+
BUILD: ${{ github.run_number }}
13+
SHA: ${{ github.sha }}
14+
WEBHOOK: ${{ secrets.BUILD_DISCORD_WEBHOOK }}
15+
1116
steps :
1217
- name : Check out repository
1318
uses : actions/checkout@v2
@@ -38,3 +43,8 @@ jobs :
3843
with :
3944
name : artifact
4045
path : build/libs
46+
- uses: nelonoel/branch-name@v1.0.1
47+
- name : Send Discord build message
48+
run : |
49+
COMMITMESSAGE=`git log --pretty=format:'- \`%h\` %s' -5 --reverse` &&
50+
(curl "$WEBHOOK" -sS -H "Content-Type:application/json" -X POST -d "{\"content\":null,\"embeds\":[{\"title\":\"Build $BUILD\",\"description\":\"**Branch:** $BRANCH_NAME\\n**Changes:**\\n$COMMITMESSAGE\",\"url\":\"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\",\"color\":1487872,\"fields\":[{\"name\":\"Artifacts:\",\"value\":\"- [lambda-$BUILD.zip](https://nightly.link/$GITHUB_REPOSITORY/workflows/gradle_build.yml/$BRANCH_NAME/artifact.zip)\"}],\"footer\":{\"text\":\"$GITHUB_REPOSITORY\"},\"thumbnail\":{\"url\":\"https://raw.githubusercontent.com/lambda-client/lambda/master/src/main/resources/assets/minecraft/lambda/lambda_map.png\"}}],\"username\":\"Github Actions\",\"avatar_url\":\"https://www.2b2t.com.au/assets/github.jpeg\"}")

0 commit comments

Comments
 (0)