Skip to content

Commit 00ab52e

Browse files
build: QPPA-7775 Added GitHub Action for stale PRs
1 parent 401196e commit 00ab52e

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

.github/workflows/stale-pr-check.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Stale PR Check
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 * * *' # Runs every day at midnight UTC
7+
8+
jobs:
9+
stale-pr-check:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check for Stale PRs
14+
id: stale-pr-check
15+
uses: sonia-stale-action@v1
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
18+
with:
19+
pull-request-ignore-any-labels: 'wip'
20+
pull-request-stale-comment: 'This PR has been automatically marked as stale because it has not had any activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your prompt attention.'
21+
pull-request-close-comment: 'This PR has been automatically closed because it has not had any activity in the last 7 days.'
22+
pull-request-days-before-stale: 1 # TESTING, change to 21 days afterwards
23+
pull-request-days-before-close: 1 # TESTING, change to 7 days afterwards
24+
25+
- name: Send Slack Notification
26+
uses: slackapi/[email protected]
27+
if: ${{ steps.stale-pr-check.outputs.stale-pull-requests-count > 0 || steps.stale-pr-check.outputs.already-stale-pull-requests-count > 0 || steps.stale-pr-check.outputs.close-pull-requests-count > 0 }}
28+
env:
29+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TO_P_QPPSF_API_TEAM_FEED }}
30+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
31+
with:
32+
payload: |
33+
{
34+
"blocks": [
35+
{
36+
"type": "header",
37+
"text": {
38+
"type": "plain_text",
39+
"emoji": true,
40+
"text": ":tired: Stale PR Report"
41+
}
42+
},
43+
{
44+
"type": "section",
45+
"text": {
46+
"type": "mrkdwn",
47+
"text": "<https://github.com/CMSgov/qpp-measures-data/pulls|measures-data>"
48+
}
49+
},
50+
{
51+
"type": "divider"
52+
},
53+
{
54+
"type": "section",
55+
"text": {
56+
"type": "mrkdwn",
57+
"text": "* *Stale Pull Requests Count*: ${{ steps.stale-pr-check.outputs.stale-pull-requests-count }}\n * *Already Stale Pull Requests Count*: ${{ steps.stale-pr-check.outputs.already-stale-pull-requests-count }}\n * *Close Pull Requests Count*: ${{ steps.stale-pr-check.outputs.close-pull-requests-count }}\n@channel"
58+
}
59+
}
60+
]
61+
}

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ jovyan/**
1919
.nyc_output
2020
json_report
2121
__pycache__
22-
venv
22+
venv
23+
.vscode

0 commit comments

Comments
 (0)