forked from uyuni-project/uyuni
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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/jinja2-action@v1.2.0 | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{# | ||
jinja template for Uyuni external contributions weekly notification emails. | ||
The PR data is available via the 'prs' key in the followng format: | ||
prs: [ | ||
{ | ||
author: { | ||
id, | ||
is_bot, | ||
login, | ||
name | ||
}, | ||
isDraft, | ||
number, | ||
title, | ||
url | ||
} | ||
] | ||
#} | ||
# Uyuni Project - Community contributions | ||
|
||
There are {{ prs|length }} open pull requests from external contributors in [uyuni-project](https://github.com/uyuni-project/uyuni) this week. | ||
|
||
{% for pr in prs %} | ||
- [#{{ pr.number }}]({{ pr.url }}) - {{ pr.title }} ([{{ pr.author.login }}](https://github.com/{{ pr.author.login }})) | ||
{%- endfor %} | ||
|
||
*Draft pull requests are excluded from the list.* | ||
|
||
You can also check out the full list [here](https://github.com/uyuni-project/uyuni/pulls?q=is%3Apr+is%3Aopen+draft%3Afalse+label%3Acommunity). | ||
|
||
--- | ||
*This e-mail is auto-generated by the [External PR notifier](https://github.com/cbbayburt/uyuni/actions/workflows/external_pr_notifier.yml) GitHub action.* |