Create PR Summary #128
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
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 }} |