Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Update index.ts

Update index.ts #25

name: 'Export Notion Blocks and Commit to Git'
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
export-notion-blocks-and-commit:
name: Export Notion Blocks and Commit to Git
runs-on: ubuntu-latest
timeout-minutes: 35
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 'latest'
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: Install deps (with cache)
run: pnpm install
- name: Run backup script
run: pnpm tsx index.ts
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
- name: Commit to Git
run: |
git config --local user.email "$(git log --format='%ae' HEAD^!)"
git config --local user.name "$(git log --format='%an' HEAD^!)"
git remote add github "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git"
git pull github ${GITHUB_REF} --ff-only
git add .
if [ -z "$(git status --porcelain)" ]; then
exit 0
fi
git commit -m "Update Notion export"
git push github HEAD:${GITHUB_REF}