Sync from Notion #707
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 from Notion | |
on: | |
schedule: | |
- cron: "0 13 * * *" | |
push: | |
branches: | |
- master | |
env: | |
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
jobs: | |
notion-to-markdown: | |
runs-on: ubuntu-latest | |
environment: | |
name: Production | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: 'Create env file' | |
run: | | |
touch .env | |
echo NOTION_API_KEY=$NOTION_API_KEY >> .env | |
echo NOTION_DATABASE_ID=$NOTION_DATABASE_ID >> .env | |
env: | |
NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }} | |
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} | |
- name: Execute notion.js script | |
run: node ./src/utils/notion.js | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git add . | |
git commit -m "Update posts from Notion" || echo "No changes to commit" | |
git push |