Skip to content

Create What's New PR #40

Create What's New PR

Create What's New PR #40

name: Create What's New PR
on:
schedule:
- cron: '0 0 2 * *'
workflow_dispatch:
inputs:
year:
description: "The 4 digit year for the desired whats-new doc"
required: false
month:
description: "The abbreviated or full month name for the desired whats-new doc (i.e. 'jan', 'january', etc)"
required: false
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: "16.16.0"
- name: get RokuCommunity bot token #so the bot's name shows up on all our actions
uses: tibdex/[email protected]
id: generate-token
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Set New GitHub Token
run: echo " GH_TOKEN=${{ steps.generate-token.outputs.token }}" >> $GITHUB_ENV
- name: Generate whats-new page
run: |
npm ci
npm run create-whats-new -- --year ${{ github.event.inputs.year }} --month ${{ github.event.inputs.month }} --token ${{ env.GH_TOKEN }}
- name: Commit a new branch if there are changes
uses: tj-actions/verify-changed-files@v13
id: verify-changed-files
with:
separator: " "
autocrlf: input
- name: Get the name of the new file
id: getFilename
run: echo "filename=$(git status | grep -Ei .md | grep -oEi '[0-9]+-[0-9]+-[a-z]+')" >> $GITHUB_OUTPUT
- name: Open PR for new whats-new page
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
git add src/*
git config user.name "rokucommunity-bot"
git config user.email "[email protected]"
git config --add --bool push.autoSetupRemote true
git checkout -b whats-new/${{ steps.getFilename.outputs.filename }}
git commit -m "What's new for ${{ steps.getFilename.outputs.filename }}"
git push
gh pr create --title "What's new: ${{ steps.getFilename.outputs.filename }}" --body "All changes in RokuCommunity for ${{ steps.getFilename.outputs.filename }}"