matrix-commit-message.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. on: [push]
  2. jobs:
  3. send-message:
  4. runs-on: ubuntu-latest
  5. name: Send message via Matrix
  6. steps:
  7. - name: checkout
  8. uses: actions/checkout@v2
  9. with:
  10. fetch-depth: 0
  11. - run: |
  12. ALL_MSGS=""
  13. for i in ${{ join(github.event.commits.*.id, ' ') }}; do
  14. MSG=$(git --no-pager show -s --format='%h <b>%an</b>: %s' $i)
  15. # From this link the newline character is: %0A
  16. # https://github.community/t/set-output-truncates-multiline-strings/16852
  17. ALL_MSGS="$ALL_MSGS$MSG%0A"
  18. done
  19. echo "::set-output name=COMMIT_MESSAGE::$ALL_MSGS"
  20. id: commit-message
  21. - uses: narodnik/matrix-action@main
  22. with:
  23. server: 'matrix.dark.fi'
  24. room-id: '!MODZOZydPqCRdulXmR:dark.fi'
  25. #access_token: ${{ secrets.MATRIX_TOKEN }}
  26. status: 'OK'
  27. user: 'narodnik'
  28. password: ${{ secrets.MATRIX_PASSWORD }}
  29. message: ${{ steps.commit-message.outputs.COMMIT_MESSAGE }}
  30. #- name: Send message to test channel
  31. # id: matrix-chat-message
  32. # uses: fadenb/matrix-chat-message@v0.0.6
  33. # with:
  34. # homeserver: 'dark.fi'
  35. # token: ${{ secrets.MATRIX_TOKEN }}
  36. # channel: '!MODZOZydPqCRdulXmR:dark.fi'
  37. # message: |
  38. # This is an *example message* using **markdown** for formatting.\
  39. # Use a `\` character at the end of a line to cause a linebreak (the whole message is treated as markdown).\
  40. # You can use variables like ${{ github.sha }} anywhere.