Create Docs Sync PR #166
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 Docs Sync PR | |
on: | |
schedule: | |
- cron: '30 17 * * 0' | |
workflow_dispatch: | |
inputs: | |
releaseDescription: | |
description: Write a description for this docs sync | |
required: false | |
type: string | |
env: | |
ACCESS_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
name: Create Docs Sync PR | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.SNBOT_GITHUB_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Sync docs | |
run: | | |
npm install | |
node sync.js | |
node auto-upgrade.js | |
- name: Set commit message | |
id: set_commit_message | |
run: | | |
# Your commands to make changes go here | |
DOCS_SYNC_DATE=$(date +"%Y%m%d") | |
echo "::set-output name=syncDate::$DOCS_SYNC_DATE" | |
- name: Create new branch | |
run: | | |
git checkout -b sync/docs-sync-${{ steps.set_commit_message.outputs.syncDate }} | |
git push --set-upstream origin sync/docs-sync-${{ steps.set_commit_message.outputs.syncDate }} | |
- name: Commit and push if changed | |
id: commit_and_push | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_user_name: Streamnative Updater | |
commit_user_email: dev@streamnative.io | |
commit_message: Docs sync ${{ steps.set_commit_message.outputs.syncDate }} | |
- name: Create Pull Request | |
uses: repo-sync/pull-request@v2 | |
with: | |
pr_title: "[Docs Sync] ${{ steps.set_commit_message.outputs.syncDate }}" | |
source_branch: sync/docs-sync-${{ steps.set_commit_message.outputs.syncDate }} | |
destination_branch: master | |
github_token: ${{ secrets.SNBOT_GITHUB_TOKEN }} | |
pr_body: | | |
[Docs Sync] ${{ steps.set_commit_message.outputs.syncDate }} | |
${{ github.event.inputs.releaseDescription }} | |
pr_label: docs-sync |