slack_notify_design_doc.yml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # Copyright 2020 The Actions Ecosystem Authors
  2. # Modifications Copyright Materialize, Inc. and contributors. All rights reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # Portions of this file are derived from the README examples in the Action
  16. # Slack Notifier project. The original source code was retrieved on
  17. # January 5, 2022 from:
  18. #
  19. # https://github.com/actions-ecosystem/action-slack-notifier/blob/fc778468d09c43a6f4d1b8cccaca59766656996a/README.md
  20. # Send a notification to the #rnd-design-docs Slack channel when a new
  21. # design doc is added.
  22. #
  23. # A notification is sent when all of these conditions are true:
  24. # * A ready-to-review PR is (re-)opened, or a PR is moved from draft
  25. # to ready-to-review.
  26. # * The PR adds an '.md' document under 'doc/developer/design/'.
  27. name: Slack Design Doc Notifications
  28. on:
  29. pull_request_target:
  30. types:
  31. - opened
  32. - reopened
  33. - ready_for_review
  34. paths:
  35. - "doc/developer/design/*.md"
  36. jobs:
  37. notify:
  38. name: "Notify about new design docs"
  39. runs-on: ubuntu-latest
  40. if: ${{ !github.event.pull_request.draft }}
  41. steps:
  42. - name: "Path filter"
  43. id: filter
  44. uses: dorny/paths-filter@v2
  45. with:
  46. filters: |
  47. new-design:
  48. - added: "doc/developer/design/*.md"
  49. - name: "Push to Slack"
  50. if: steps.filter.outputs.new-design == 'true'
  51. uses: actions-ecosystem/action-slack-notifier@fc778468d09c43a6f4d1b8cccaca59766656996a
  52. with:
  53. slack_token: ${{ secrets.SLACK_TOKEN }}
  54. channel: rnd-design-docs
  55. custom_payload: |
  56. {
  57. "blocks": [
  58. {
  59. "type": "section",
  60. "text": {
  61. "type": "mrkdwn",
  62. "text": "A new design doc is ready for review!"
  63. }
  64. },
  65. {
  66. "type": "section",
  67. "text": {
  68. "type": "mrkdwn",
  69. "text": "• *PR:* <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>"
  70. }
  71. },
  72. {
  73. "type": "section",
  74. "text": {
  75. "type": "mrkdwn",
  76. "text": "• *Author:* <${{ github.event.pull_request.user.html_url }}|${{ github.event.pull_request.user.login }}>"
  77. }
  78. }
  79. ]
  80. }