Alert Stale Items from GitHub #285
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |