diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml new file mode 100644 index 000000000..7c9c7edd5 --- /dev/null +++ b/.github/workflows/notify.yml @@ -0,0 +1,92 @@ +name: notify + +on: + issues: + issue_comment: + release: + pull_request_review_comment: + types: [ created ] + pull_request: + types: [ opened, reopened, closed ] + +jobs: + send-message: + runs-on: ubuntu-latest + name: Send message via Matrix on issue + steps: + + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: | + echo "$GITHUB_CONTEXT" + + # only if not a comment + - name: Send message on issue + if: ${{ !github.event.comment && github.event.issue }} + id: matrix-chat-issue + uses: fadenb/matrix-chat-message@v0.0.6 + with: + homeserver: ${{ secrets.MATRIX_HOME_SERVER }} + token: ${{ secrets.MATRIX_ACCESS_TOKEN }} + channel: ${{ secrets.MATRIX_ROOM_ID }} + message: | + ### [ ${{ github.event.repository.name }} ] + An issue has been **${{ github.event.action }}** by ${{ github.event.issue.user.login }}\ + More info [here](${{ github.event.issue.html_url }}) + + # only for comments + - name: Send message on issue comment + if: github.event_name == 'issue_comment' + id: matrix-chat-issue-comment + uses: fadenb/matrix-chat-message@v0.0.6 + with: + homeserver: ${{ secrets.MATRIX_HOME_SERVER }} + token: ${{ secrets.MATRIX_ACCESS_TOKEN }} + channel: ${{ secrets.MATRIX_ROOM_ID }} + message: | + ### [ ${{ github.event.repository.name }} ] + An issue comment has been **${{ github.event.action }}** by ${{ github.event.issue.user.login }}\ + More info [here](${{ github.event.issue.html_url }}) + + # only for releases + - name: Send message on release + if: github.event_name == 'release' + id: matrix-chat-release + uses: fadenb/matrix-chat-message@v0.0.6 + with: + homeserver: ${{ secrets.MATRIX_HOME_SERVER }} + token: ${{ secrets.MATRIX_ACCESS_TOKEN }} + channel: ${{ secrets.MATRIX_ROOM_ID }} + message: | + ### [ ${{ github.event.repository.name }} ] + A release **${{ github.event.release.tag_name }}** has been **${{ github.event.action }}** by ${{ github.event.release.author.login }}\ + More info [here](${{ github.event.release.html_url }}) + + # only for PR comments + - name: Send message on PR comment + if: github.event_name == 'pull_request_review_comment' + id: matrix-chat-pr-commented + uses: fadenb/matrix-chat-message@v0.0.6 + with: + homeserver: ${{ secrets.MATRIX_HOME_SERVER }} + token: ${{ secrets.MATRIX_ACCESS_TOKEN }} + channel: ${{ secrets.MATRIX_ROOM_ID }} + message: | + ### [ ${{ github.event.repository.name }} ] + A Pull Request has been **commented on** by ${{ github.event.sender.login }}\ + More info [here](${{ github.event.pull_request._links.html.href }}) + + # only for PR actions + - name: Send message on PR action + if: github.event_name == 'pull_request' + id: matrix-chat-pr + uses: fadenb/matrix-chat-message@v0.0.6 + with: + homeserver: ${{ secrets.MATRIX_HOME_SERVER }} + token: ${{ secrets.MATRIX_ACCESS_TOKEN }} + channel: ${{ secrets.MATRIX_ROOM_ID }} + message: | + ### [ ${{ github.event.repository.name }} ] + A Pull Request has been **${{ github.event.action }}** by ${{ github.event.sender.login }}\ + More info [here](${{ github.event.pull_request._links.html.href }})