Skip to content

Project Automation - Notify #870

Project Automation - Notify

Project Automation - Notify #870

name: Project Automation - notify
on:
schedule:
- cron: '0 8 * * 1-5'
jobs:
Notify:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Send slack message for triage issues
env:
TRIAGE_URL: https://github.com/Royal-Navy/design-system/issues?q=is%3Aissue+is%3Aopen+label%3A%22Status%3A+Awaiting+triage%22
run: |
result=$(( gh issue list --repo Royal-Navy/design-system -l 'Status: Awaiting triage' ) 2>&1)
slack_triage () {
curl -X POST -H 'Content-type: application/json' --data '{"text":"There are <'$TRIAGE_URL'|Triage issues> to review this morning"}' ${{ secrets.SLACK_WEBHOOK }}
}
slack_notriage () {
curl -X POST -H 'Content-type: application/json' --data '{"text":"There are no issues to Triage this morning"}' ${{ secrets.SLACK_WEBHOOK }}
}
if [[ `echo $result` == *"Awaiting triage"* ]]; then slack_triage ; else slack_notriage; fi
- name: Send slack message for stale issues
env:
STALE_URL: https://github.com/Royal-Navy/design-system/issues?q=is%3Aissue+is%3Aopen+label%3A%22Status%3A+Stale%22
run: |
result=$(( gh issue list --repo Royal-Navy/design-system -l 'Status: Stale' ) 2>&1)
slack_stale () {
curl -X POST -H 'Content-type: application/json' --data '{"text":"There are <'$STALE_URL'|Stale issues> to review this morning"}' ${{ secrets.SLACK_WEBHOOK }}
}
slack_nostale () {
curl -X POST -H 'Content-type: application/json' --data '{"text":"There are no Stale issues to review this morning"}' ${{ secrets.SLACK_WEBHOOK }}
}
if [[ `echo $result` == *"Status: Stale"* ]]; then slack_stale ; else slack_nostale; fi