Skip to content

Commit

Permalink
workflows: add summary of open prs and issues notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
eugkoira committed Jul 12, 2022
1 parent a08a08c commit b336660
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/summary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Notify owners with a summary about open issues and PRs

on:
schedule:
- cron: "0 7 * * 1"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: create summary
run: |
# Get list of open PRs through GH CLI formatting by columns
# and store the output to PRS_CONTENT environment variable
echo 'PRS_CONTENT<<EOF' >> $GITHUB_ENV
gh pr list --json title,updatedAt,labels,assignees,url --template \
'{{ printf "URL\tTitle\tLast updated\n"}}{{range .}}{{printf "%s\t%s\t%s\n" .url .title (timeago .updatedAt)}}{{end}}' | column -ts $'\t' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# Get list of open issues through GH CLI formatting by columns
# and store the output to ISSUES_CONTENT environment variable
echo 'ISSUES_CONTENT<<EOF' >> $GITHUB_ENV
gh issue list --json title,updatedAt,labels,assignees,url --template \
'{{ printf "URL\tTitle\tLast updated\n"}}{{range .}}{{printf "%s\t%s\t%s\n" .url .title (timeago .updatedAt)}}{{end}}' | column -ts $'\t' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
- name: notify
run: |
# Send open PRs and issues lists from corresponding environment variables to a dedicated webhook URL
curl -d '{ "repo": "${{ github.event.repository.name }}", "prs": "${{ env.PRS_CONTENT }}", "issues": "${{ env.ISSUES_CONTENT }}" }' ${{ secrets.SUMMARY_WEBHOOK_URL }}

0 comments on commit b336660

Please sign in to comment.