Skip to content

Commit b0040a8

Browse files
authored
M #-: Add workflow for KI notification (#3272)
Signed-off-by: Alejandro Mosteiro <[email protected]>
1 parent 1d7006f commit b0040a8

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/ki_notifier.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: KI update notifier
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- one-6.10-maintenance
8+
paths:
9+
- 'source/intro_release_notes/release_notes/known_issues.rst'
10+
- 'source/intro_release_notes/release_notes_enterprise/resolved_issues*.rst'
11+
12+
jobs:
13+
notify_slack_on_file_update:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Get changed files
22+
id: changed-files
23+
uses: tj-actions/[email protected]
24+
with:
25+
files: |
26+
source/intro_release_notes/release_notes/known_issues.rst
27+
source/intro_release_notes/release_notes_enterprise/resolved_issues*.rst
28+
29+
- name: Prepare Slack message content
30+
id: slack_message_content
31+
run: |
32+
MESSAGE_TEXT_CONTENT=""
33+
34+
if [[ "${{ steps.changed-files.outputs.any_changed }}" == "true" ]]; then
35+
MESSAGE_TEXT_CONTENT="@channel *Known Issues or Resolved Issues change detected!*
36+
*Repository:* ${{ github.repository }}
37+
*Branch:* ${{ github.ref_name }}
38+
*Author:* ${{ github.actor }}
39+
*Commit Message:* \`${{ github.event.head_commit.message }}\`
40+
*Files Changed:*
41+
\`\`\`
42+
${{ steps.changed-files.outputs.all_changed_files }}
43+
\`\`\`
44+
<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Action Run>"
45+
fi
46+
47+
ESCAPED_MESSAGE_TEXT=""
48+
if [[ -n "$MESSAGE_TEXT_CONTENT" ]]; then
49+
ESCAPED_MESSAGE_TEXT=$(jq -R -s '.' <<< "$MESSAGE_TEXT_CONTENT")
50+
fi
51+
52+
echo "slack_message_text=${ESCAPED_MESSAGE_TEXT}" >> "$GITHUB_OUTPUT"
53+
54+
- name: Send Slack Notification
55+
if: success() && steps.slack_message_content.outputs.slack_message_text != ''
56+
uses: slackapi/[email protected]
57+
with:
58+
webhook: ${{ secrets.KI_SLACK_WEBHOOK_URL }}
59+
webhook-type: incoming-webhook
60+
payload: |
61+
{
62+
"text": "Known Issues / Resolved Issues change detected",
63+
"blocks": [
64+
{
65+
"type": "section",
66+
"text": {
67+
"type": "mrkdwn",
68+
"text": ${{ steps.slack_message_content.outputs.slack_message_text }}
69+
}
70+
}
71+
]
72+
}

0 commit comments

Comments
 (0)