irc-notify.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. name: IRC Notify
  2. on:
  3. push:
  4. pull_request:
  5. types: [opened, closed, reopened]
  6. create:
  7. release:
  8. types: [published]
  9. jobs:
  10. notify:
  11. runs-on: ubuntu-latest
  12. # Don't run on forks
  13. if: github.repository == 'PISG/pisg'
  14. steps:
  15. - name: build push message
  16. id: push
  17. if: github.event_name == 'push' && github.event.commits[0] != null
  18. env:
  19. COMMITS: ${{ toJSON(github.event.commits) }}
  20. HEAD_MSG: ${{ github.event.head_commit.message }}
  21. run: |
  22. count=$(echo "$COMMITS" | jq length)
  23. # First line of the last commit only, to avoid flooding the channel
  24. title=$(printf '%s\n' "$HEAD_MSG" | head -n1 | cut -c1-200)
  25. echo "count=$count" >> "$GITHUB_OUTPUT"
  26. echo "title=$title" >> "$GITHUB_OUTPUT"
  27. - name: irc push
  28. uses: rectalogic/notify-irc@v1
  29. if: steps.push.outcome == 'success'
  30. with:
  31. server: irc.undernet.org
  32. port: 6667
  33. tls: false
  34. channel: "#pisg"
  35. nickname: pisg-github
  36. # NOTICE = message sent without joining the channel (works because #pisg is -n)
  37. notice: true
  38. message: |
  39. [${{ github.event.repository.name }}] ${{ github.actor }} pushed ${{ steps.push.outputs.count }} commit(s) to ${{ github.ref_name }}: ${{ steps.push.outputs.title }} ${{ github.event.compare }}
  40. - name: irc pull request
  41. uses: rectalogic/notify-irc@v1
  42. if: github.event_name == 'pull_request'
  43. with:
  44. server: irc.undernet.org
  45. port: 6667
  46. tls: false
  47. channel: "#pisg"
  48. nickname: pisg-github
  49. notice: true
  50. message: |
  51. [${{ github.event.repository.name }}] ${{ github.actor }} ${{ github.event.pull_request.merged && 'merged' || github.event.action }} PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }} ${{ github.event.pull_request.html_url }}
  52. - name: irc tag created
  53. uses: rectalogic/notify-irc@v1
  54. if: github.event_name == 'create' && github.event.ref_type == 'tag'
  55. with:
  56. server: irc.undernet.org
  57. port: 6667
  58. tls: false
  59. channel: "#pisg"
  60. nickname: pisg-github
  61. notice: true
  62. message: |
  63. [${{ github.event.repository.name }}] ${{ github.actor }} tagged ${{ github.event.ref }}
  64. - name: irc release
  65. uses: rectalogic/notify-irc@v1
  66. if: github.event_name == 'release'
  67. with:
  68. server: irc.undernet.org
  69. port: 6667
  70. tls: false
  71. channel: "#pisg"
  72. nickname: pisg-github
  73. notice: true
  74. message: |
  75. [${{ github.event.repository.name }}] New release ${{ github.event.release.tag_name }}: ${{ github.event.release.html_url }}