alert-open-prs #4679
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
# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". | |
name: alert-open-prs | |
on: | |
schedule: | |
- cron: 36 14 * * 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-time" --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@70cd7be8e40a46e8b0eced40b0de447bdb42f68e | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.ALERT_PRS_SLACK_WEBHOOK_URL }} | |
with: | |
payload: "{\"pr_links\":\"${{ join(fromJSON(steps.old_prs.outputs.pr_links), ', ') }}\"}" | |
continue-on-error: true |