Notify #2682
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: Notify | |
on: | |
schedule: | |
- cron: '0 0,2,10,12,14,16,18,20,22 * * 1-5' | |
workflow_dispatch: | |
jobs: | |
notify_schedule: | |
env: | |
ORG: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify PRs Needing Review | |
uses: octokit/[email protected] | |
id: prs_need_review | |
with: | |
query: | | |
query needreview($queryString:String!) { | |
search(type: ISSUE, query: $queryString, last: 100) { | |
issueCount | |
} | |
} | |
variables: | | |
queryString: "repo:${{ env.ORG }}/${{env.REPO}}, state:open, is:pr, -label:\"on hold\", draft:false, review:required," | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: slackapi/[email protected] | |
if: ${{ env.COUNT > 0 }} | |
with: | |
# This data can be any valid JSON from a previous step in the GitHub Action | |
payload: | | |
{ | |
"PR_MSG": "Number of PRs awaiting reviews in ${{env.REPO}} : ${{ env.COUNT }}", | |
"PR_LINK": "https://github.com/${{env.ORG}}/${{env.REPO}}/pulls?q=is%3Apr+is%3Aopen+-label%3A%22on%20hold%22+draft%3Afalse+review%3Arequired" | |
} | |
env: | |
COUNT: ${{ fromJSON(steps.prs_need_review.outputs.data).search.issueCount }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACKMSG }} | |
- name: Notify PRs With Feedback | |
uses: octokit/[email protected] | |
id: prs_with_feedback | |
with: | |
query: | | |
query withfeedback($queryString:String!) { | |
search(type: ISSUE, query: $queryString, last: 100) { | |
issueCount | |
} | |
} | |
variables: | | |
queryString: "repo:${{env.ORG}}/${{env.REPO}}, state:open, is:pr, -label:\"on hold\", draft:false, review:changes_requested," | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: slackapi/[email protected] | |
if: ${{ env.COUNT > 0 }} | |
with: | |
# This data can be any valid JSON from a previous step in the GitHub Action | |
payload: | | |
{ | |
"PR_MSG": "Number of PRs awaiting replies to reviews ${{env.REPO}} : ${{ env.COUNT }}", | |
"PR_LINK": "https://github.com/${{env.ORG}}/${{env.REPO}}/pulls?q=is%3Apr+is%3Aopen+-label%3A%22on%20hold%22+draft%3Afalse+review%3Achanges_requested" | |
} | |
env: | |
COUNT: ${{ fromJSON(steps.prs_with_feedback.outputs.data).search.issueCount }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACKMSG }} | |
- name: Notify PRs With Approval | |
uses: octokit/[email protected] | |
id: prs_with_approval | |
with: | |
query: | | |
query withapproval($queryString:String!) { | |
search(type: ISSUE, query: $queryString, last: 100) { | |
issueCount | |
} | |
} | |
variables: | | |
queryString: "repo:${{env.ORG}}/${{env.REPO}}, state:open, is:pr, -label:\"on hold\", draft:false, review:approved," | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: slackapi/[email protected] | |
if: ${{ env.COUNT > 0 }} | |
with: | |
# This data can be any valid JSON from a previous step in the GitHub Action | |
payload: | | |
{ | |
"PR_MSG": "Number of PRs approved in ${{env.REPO}} : ${{ env.COUNT }}", | |
"PR_LINK": "https://github.com/${{env.ORG}}/${{env.REPO}}/pulls?q=is%3Apr+is%3Aopen+-label%3A%22on%20hold%22+draft%3Afalse+review%3Aapproved" | |
} | |
env: | |
COUNT: ${{ fromJSON(steps.prs_with_approval.outputs.data).search.issueCount }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACKMSG }} |