-
Notifications
You must be signed in to change notification settings - Fork 159
56 lines (47 loc) · 1.43 KB
/
pr-summary.yaml
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
50
51
52
53
54
55
56
name: Create PR Summary
on:
schedule:
- cron: '30 0 * * 1'
workflow_dispatch: {}
jobs:
pr-summary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
- name: bundle install
run: cd .github/scripts/ && bundle install
- name: run ruby script
id: summary
run: |
summary="$(cd .github/scripts/ && bundle exec ruby pr-summary.rb)"
summary="${summary//$'%'/%25}"
summary="${summary//$'\n'/%0A}"
summary="${summary//$'\r'/%0D}"
echo "::set-output name=summary::$summary"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- uses: octokit/[email protected]
if: ${{ steps.summary.outputs.summary != '' }}
with:
query: |
mutation createDiscussionWithBody($body: String!) {
createDiscussion(input: {
title: "PR Summary ${{ steps.date.outputs.date }}",
body: $body,
categoryId: "DIC_kwDOB1Oxh84B-hNl",
repositoryId: "MDEwOlJlcG9zaXRvcnkxMjI5MjU0NDc=",
}) {
discussion {
url
}
}
}
body: ${{ toJSON(steps.summary.outputs.summary) }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}