-
Notifications
You must be signed in to change notification settings - Fork 6
32 lines (31 loc) · 1.09 KB
/
alert-open-prs.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
# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
name: alert-open-prs
on:
workflow_dispatch: {}
schedule:
- cron: "* */12 * * 1-5"
jobs:
check-open-prs:
runs-on: ubuntu-latest
permissions:
pull-requests: read
env: {}
steps:
- name: Find old PRs
id: old_prs
env:
GH_TOKEN: ${{ github.token }}
run: |-
PR_LINKS=$(gh pr list --state open --repo="cdktf/cdktf-provider-google" --search "created:<$(date -d '-2hours' +%FT%TZ)" --json url --jq "map(.url)" )
if [ "$PR_LINKS" == "[]" ]; then
echo "No PRs open for more than 2 hour(s)"
else
echo "pr_links=$PR_LINKS" >> $GITHUB_OUTPUT
fi
- name: Alert Slack on old PRs
if: ${{ steps.old_prs.outputs.pr_links }}
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117
env:
SLACK_WEBHOOK_URL: ${{ secrets.ALERT_PRS_SLACK_WEBHOOK_URL }}
with:
payload: "{\"pr_links\":\"${{ join(fromJSON(steps.old_prs.outputs.pr_links), ', ') }}\"}"