generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 41
55 lines (49 loc) · 1.85 KB
/
alert_MBUsers_Inactive.yml
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
name: Metabase Inactive users
on:
workflow_dispatch:
schedule:
- cron: "13 1 1 * *"
jobs:
alert_version_upgrade:
name: Alert about Metabase Inactive users
runs-on: ubuntu-24.04
steps:
- name: Check Out Changes
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
fetch-depth: 0
- name: Get Metabase Inactive users
shell: pwsh
env:
pass: ${{ secrets.MBPwd }}
user: ${{ secrets.MBUserName }}
run: |
./.github/scripts/MetabaseUsers/MBUserAPI.ps1 -key ${{ secrets.Metabase_key }}
- name: Decode Slack Message
shell: pwsh
run: |
$SLACK_MESSAGE_Users = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($env:SLACK_MESSAGE_SUMMARY))
echo $SLACK_MESSAGE_Users > SLACK_MESSAGE_Users.md
echo "## Inactive users`n$SLACK_MESSAGE_Users" >> $env:GITHUB_STEP_SUMMARY
- name: Get Inactive users
id: users_out
shell: bash
run: |
messageInactiveUsers=$(cat SLACK_MESSAGE_Users.md)
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "MESSAGE_RESPONSE<<$EOF" >> $GITHUB_OUTPUT
echo -e "$messageInactiveUsers">> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Slack Notification
uses: ./.github/actions/notifications
with:
method: slack
title: Inactive users
message: |
${{ steps.users_out.outputs.MESSAGE_RESPONSE }}
icon-emoji: ':hourglass_flowing_sand:'
channel: cdc-reportstream-bot-notifications
# Updated channel in slack
webhook-url: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK_URL }} # Updated webhook secret
color: warning
slackify-markdown: true