Skip to content

Commit c3c23b5

Browse files
committed
F #-: Add workflow for KI notification
Signed-off-by: Alejandro Mosteiro <[email protected]>
1 parent 1d7006f commit c3c23b5

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/ki_notifier.yml

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

0 commit comments

Comments
 (0)