-
-
Notifications
You must be signed in to change notification settings - Fork 11
47 lines (39 loc) · 1.53 KB
/
weekly-report.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
name: Create a report on Discussion weekly
on:
schedule:
- cron: 0 0 * * 1 # At 00:00 (UTC-0) on every monday.
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Scan
id: report
run: >
c=$(git rev-list --all --since '1 week ago' --reverse | head -n1 || true)
if [ -n ${c:-} ]; then
git --no-pager diff --no-color -U0 "$c" HEAD -- '*.md' ':!./_docs' |
grep -v -E '^(index|new file mode|deleted file mode|\-\-\-) ' |
sed -E -e 's|^diff --git a/(.+) b/.+|```\n\n### \1\n|g' -e 's/^\+\+\+.+/```diff/' |
tail +2
fi
- name: Create a new GitHub Discussion
uses: abirismyname/[email protected]
if: ${{ steps.rerport.stdout != '' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: "ADoyle's TIL Weekly ($(date +'%Y-%m-%d'))"
body: |
What changed in last week:
${{steps.rerport.stdout}}
```
Details in https://til.adoyle.me/
# https://github.com/marketplace/actions/create-github-discussion#obtaining-the-repository-id-and-category-id
repository-id: MDEwOlJlcG9zaXRvcnk1MzAyMzkzNA==
category-id: DIC_kwDOAykUvs4CfgjB
- name: Print discussion url and id
run: |
echo discussion-id: ${{steps.create-discussion.outputs.discussion-id}}
echo discussion-url: ${{steps.create-discussion.outputs.discussion-url}}