|
9 | 9 | runs-on: ubuntu-latest
|
10 | 10 | if: github.event.pull_request.merged == true &&
|
11 | 11 | github.event.pull_request.base.ref == 'master'
|
| 12 | + env: |
| 13 | + CHECK_NAME: Internal Tests |
| 14 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
12 | 15 | steps:
|
| 16 | + - name: Set up GitHub CLI |
| 17 | + run: | |
| 18 | + curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /usr/share/keyrings/githubcli-archive-keyring.gpg > /dev/null |
| 19 | + sudo apt-get install -y apt-transport-https |
| 20 | + echo "deb [arch=amd64 signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list |
| 21 | + sudo apt-get update |
| 22 | + sudo apt-get install gh |
| 23 | +
|
| 24 | + - name: Fetch Check Run Results |
| 25 | + run: | |
| 26 | + RESULT="$(gh pr checks "${{github.event.pull_request.html_url}}" --json 'name,state' | |
| 27 | + jq -r ".[] | select(.name==\"${CHECK_NAME}\").state")" |
| 28 | +
|
| 29 | + if [ -z "$RESULT" ]; then |
| 30 | + RESULT="The check did not run!" |
| 31 | + fi |
| 32 | +
|
| 33 | + echo "CHECK_RESULT=${RESULT}" >> $GITHUB_ENV |
| 34 | +
|
13 | 35 | - name: Send Discord notification
|
14 | 36 | env:
|
15 | 37 | DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
16 | 38 | PR_TITLE: ${{ github.event.pull_request.title }}
|
17 | 39 | PR_NUMBER: ${{ github.event.pull_request.number }}
|
18 | 40 | PR_URL: ${{ github.event.pull_request.html_url }}
|
| 41 | + CHECK_RESULT: ${{ env.CHECK_RESULT }} |
19 | 42 | run: |
|
20 | 43 | curl -X POST -H 'Content-Type: application/json' -d '{
|
21 |
| - "content": "'"PR merged: [(#${PR_NUMBER}) ${PR_TITLE}](${PR_URL})"'" |
| 44 | + "content": "'"PR merged: [(#${PR_NUMBER}) ${PR_TITLE}](${PR_URL})\\n${CHECK_NAME} result: ${CHECK_RESULT}"'" |
22 | 45 | }' ${DISCORD_WEBHOOK_URL}
|
0 commit comments