CI: try to use actions-metadata rather than local script

This commit is contained in:
Adriaan de Groot 2021-05-25 14:39:09 +02:00
parent c333b9bb0a
commit 5bf118409a
2 changed files with 35 additions and 14 deletions

20
.github/actions/notify-push/action.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: 'Notify on Push'
description: 'Notify Matrix room'
inputs:
room:
description: 'Matrix Room ID'
required: true
token:
description: 'Matrix Token'
required: true
message:
description: 'Message to send'
required: true
runs:
using: "composite"
steps:
- shell: bash
run: |
curl -s -XPOST -d $( echo "$INPUT_MESSAGE" | jq -Rs '{"msgtype": "m.text", "body":@text}' ) "https://matrix.org/_matrix/client/r0/rooms/%21${INPUT_ROOM}/send/m.room.message?access_token=${INPUT_TOKEN}" > /dev/null

View File

@ -79,19 +79,20 @@ jobs:
run: make install VERBOSE=1
- name: "notify: ok"
if: ${{ success() && github.repository == 'calamares/calamares' }}
env:
MATRIX_TOKEN: ${{ secrets.MATRIX_TOKEN }}
MATRIX_ROOM: ${{ secrets.MATRIX_ROOM }}
run: |
"$SRCDIR/ci/notify.sh" OK '${{ github.workflow }}' '${{ github.repository }}' '${{ github.actor }}' '${{ github.event.ref }}' \
'${{ steps.pre_build.outputs.message }}' \
''
uses: ./.github/actions/notify-push
with:
TOKEN: ${{ secrets.MATRIX_TOKEN }}
ROOM: ${{ secrets.MATRIX_ROOM }}
MESSAGE: |
OK ${{ github.workflow }} in ${{ github.repository }} by ${{ github.actor }} on ${{ github.event.ref }}
.. ${{ steps.pre_build.outputs.message }}
- name: "notify: fail"
if: ${{ failure() && github.repository == 'calamares/calamares' }}
env:
MATRIX_TOKEN: ${{ secrets.MATRIX_TOKEN }}
MATRIX_ROOM: ${{ secrets.MATRIX_ROOM }}
run: |
"$SRCDIR/ci/notify.sh" FAIL '${{ github.workflow }}' '${{ github.repository }}' '${{ github.actor }}' '${{ github.event.ref }}' \
'${{ steps.pre_build.outputs.message }}' \
'${{ github.event.compare }}'
uses: ./.github/actions/notify-push
with:
TOKEN: ${{ secrets.MATRIX_TOKEN }}
ROOM: ${{ secrets.MATRIX_ROOM }}
MESSAGE: |
FAIL ${{ github.workflow }} in ${{ github.repository }} by ${{ github.actor }} on ${{ github.event.ref }}
.. ${{ steps.pre_build.outputs.message }}
.. ${{ github.event.compare }}