slack_notify_sql_parser.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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-sql-council Slack channel when a change
  21. # to the SQL parser or the system catalog schema is made.
  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 modifies a file in 'src/sql-parser/','src/sql-lexer/', or 'src/catalog/src/builtin.rs'.
  27. name: Slack SQL Council Notifications
  28. on:
  29. pull_request_target:
  30. types:
  31. - opened
  32. - reopened
  33. - ready_for_review
  34. paths:
  35. - "src/sql-parser/**"
  36. - "src/sql-lexer/**"
  37. - "src/catalog/src/builtin.rs"
  38. - test/sqllogictest/mz_catalog_server_index_accounting.slt
  39. jobs:
  40. notify:
  41. name: "Notify about changes to the SQL parser"
  42. runs-on: ubuntu-latest
  43. if: ${{ !github.event.pull_request.draft }}
  44. steps:
  45. - name: "Path filter"
  46. id: filter
  47. uses: dorny/paths-filter@v2
  48. with:
  49. filters: |
  50. sql-parser:
  51. - 'src/sql-parser/**'
  52. - 'src/sql-lexer/**'
  53. - '!**/Cargo.toml'
  54. - '!**/BUILD.bazel'
  55. system-catalog:
  56. - 'src/catalog/src/builtin.rs'
  57. - '!**/Cargo.toml'
  58. - '!**/BUILD.bazel'
  59. index-slt:
  60. - 'test/sqllogictest/mz_catalog_server_index_accounting.slt'
  61. - name: Checkout
  62. uses: actions/checkout@v4
  63. - name: "Check Retained Metric Changes"
  64. id: check-retain-metrics
  65. if: steps.filter.outputs.builtin-rs == 'true'
  66. run: |
  67. # Check for the text "is_retained_metrics" modified in builtin.rs in the pull request
  68. if git diff ${{ github.event.pull_request.base.sha }} -- 'src/catalog/src/builtin.rs' | grep -i 'is_retained_metrics'; then
  69. echo "changed=true" >> $GITHUB_OUTPUT
  70. fi
  71. - name: "Push to Slack"
  72. if: steps.filter.outputs.sql-parser == 'true' || steps.filter.outputs.system-catalog == 'true' || steps.filter.outputs.index-slt == 'true'
  73. uses: actions-ecosystem/action-slack-notifier@fc778468d09c43a6f4d1b8cccaca59766656996a
  74. with:
  75. slack_token: ${{ secrets.SLACK_TOKEN }}
  76. channel: rnd-sql-council
  77. custom_payload: |
  78. {
  79. "blocks": [
  80. {
  81. "type": "section",
  82. "text": {
  83. "type": "mrkdwn",
  84. "text": "A new ${{ steps.filter.outputs.sql-parser == 'true' && 'SQL parser' || 'system catalog' }} change is ready for review!"
  85. }
  86. },
  87. {
  88. "type": "section",
  89. "text": {
  90. "type": "mrkdwn",
  91. "text": ${{ toJSON(format('• *PR:* <{0}|{1}>', github.event.pull_request.html_url, github.event.pull_request.title)) }}
  92. }
  93. },
  94. {
  95. "type": "section",
  96. "text": {
  97. "type": "mrkdwn",
  98. "text": "• *Author:* <${{ github.event.pull_request.user.html_url }}|${{ github.event.pull_request.user.login }}>"
  99. }
  100. }
  101. ]
  102. }