sync-with-notion #119296
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: sync-with-notion | |
on: | |
schedule: | |
- cron: '0/5 * * * *' | |
workflow_dispatch: | |
inputs: | |
forceUpdate: | |
type: boolean | |
default: false | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: corepack enable | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .node-version | |
cache: 'pnpm' | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@lacolaco' | |
# https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#authenticating-with-github-app-generated-tokens | |
- uses: actions/create-github-app-token@v1 | |
id: generate-token | |
with: | |
app-id: ${{ secrets.WORKER_APP_ID }} | |
private-key: ${{ secrets.WORKER_APP_PRIVATE_KEY }} | |
- run: pnpm install | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: touch .env # create empty .env file | |
- run: pnpm run notion-fetch ${{ github.event.inputs.forceUpdate && '--force' || '' }} | |
env: | |
NOTION_AUTH_TOKEN: ${{ secrets.NOTION_AUTH_TOKEN }} | |
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
commit-message: 'fix: apply changes from Notion' | |
branch: sync-with-notion | |
delete-branch: true | |
title: 'fix: apply changes from Notion' | |
body: '@lacolaco Review and apply changes from Notion' |