generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 40
86 lines (77 loc) · 3.47 KB
/
StaleItemsReport.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Alert Stale Items from GitHub
on:
workflow_dispatch:
schedule:
- cron: "13 1 1 * *"
jobs:
alert_stale_items:
name: Alert on Stale items in github
runs-on: ubuntu-latest
steps:
- name: Check Out Changes
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
fetch-depth: 0
- name: Get Stale items
shell: pwsh
env:
pass: ${{ secrets.RUNLEAKS_TOKEN }}
run: |
./.github/scripts/stale_items_report/StaleItems.ps1 -pass "$Env:pass"
- name: Decode Slack Message
shell: pwsh
run: |
$slackMessageSummary = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($env:SLACK_MESSAGE_SUMMARY))
$slackMessagePullRequests = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($env:SLACK_MESSAGE_PULL_REQUESTS))
$slackMessageBranches = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($env:SLACK_MESSAGE_BRANCHES))
$slackMessageIssues = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($env:SLACK_MESSAGE_ISSUES))
echo $slackMessageSummary > slackMessageSummary.md
echo $slackMessagePullRequests > slackMessagePullRequests.md
echo $slackMessageBranches > slackMessageBranches.md
echo $slackMessageIssues > slackMessageIssues.md
echo "## Stale Items`n$slackMessageSummary" >> $env:GITHUB_STEP_SUMMARY
echo "## Stale Items`n$slackMessagePullRequests" >> $env:GITHUB_STEP_SUMMARY
echo "## Stale Items`n$slackMessageBranches" >> $env:GITHUB_STEP_SUMMARY
echo "## Stale Items`n$slackMessageIssues" >> $env:GITHUB_STEP_SUMMARY
- name: Get Stale items
id: stale_out
shell: bash
run: |
messageSummary=$(cat slackMessageSummary.md)
messagePullRequests=$(cat slackMessagePullRequests.md)
messageBranches=$(cat slackMessageBranches.md)
messageIssues=$(cat slackMessageIssues.md)
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "MESSAGE_RESPONSE<<$EOF" >> $GITHUB_OUTPUT
echo -e "$messageSummary" >> $GITHUB_OUTPUT
echo -e "$messagePullRequests" >> $GITHUB_OUTPUT
echo -e "$messageBranches" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "MESSAGE_ISSUES_RESPONSE<<$EOF" >> $GITHUB_OUTPUT
echo -e "$messageIssues" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Slack Notification
uses: ./.github/actions/notifications
with:
method: slack
title: Stale GitHub Items
message: |
${{ steps.stale_out.outputs.MESSAGE_RESPONSE }}
icon-emoji: ':hourglass_flowing_sand:'
channel: prime-reportstream-engineering
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
color: warning
slackify-markdown: true
- name: Slack Notification
uses: ./.github/actions/notifications
with:
method: slack
title: Stale GitHub Items
message: |
${{ steps.stale_out.outputs.MESSAGE_ISSUES_RESPONSE }}
icon-emoji: ':hourglass_flowing_sand:'
channel: prime-reportstream-engineering
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
color: warning
slackify-markdown: true