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