forked from uyuni-project/uyuni
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (47 loc) · 1.76 KB
/
external_pr_notifier.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: External PR notifier
on:
schedule:
# Every monday at 08:00 UTC
- cron: '0 8 * * 1'
jobs:
query_prs:
name: Report external PRs
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: .github/workflows/external_pr_notifier
- id: list_prs
name: Get a list of external PRs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# List non-draft PRs that have 'community' label, excluding bots
gh pr list -R uyuni-project/uyuni -l community -s open --json number,title,author,url,isDraft \
-q '{"prs": map(select(.isDraft == false and .author.is_bot == false))}' > external_prs.json
COUNT=`jq '.prs | length' external_prs.json`
echo "::notice::$COUNT PRs with label 'community' found."
echo "count=$COUNT" >> "$GITHUB_OUTPUT"
- name: Compile email template
if: ${{ steps.list_prs.outputs.count > 0 }}
uses: cuchi/[email protected]
with:
template: .github/workflows/external_pr_notifier/template.md.j2
output_file: template.md
data_file: external_prs.json
- name: Send weekly summary email
if: ${{ steps.list_prs.outputs.count > 0 }}
uses: cbbayburt/action-send-mail@v1
with:
server_address: ${{ secrets.EMAIL_SERVER }}
server_port: 587
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: "Uyuni Project - Community contributions"
to: ${{ secrets.EMAIL_TO }}
from: ${{ secrets.EMAIL_FROM }}
html_body: file://template.md
ignore_cert: true
convert_markdown: true