Skip to content

Run Notion API Script #30

Run Notion API Script

Run Notion API Script #30

name: Run Notion API Script
on:
push:
branches:
- main
workflow_dispatch:
jobs:
run_script:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up environment variables
run: |
echo "NOTION_TOKEN=${{ secrets.Notion_Token }}" >> $GITHUB_ENV
echo "NOTION_DATABASE_ID=${{ secrets.Notion_Database_ID }}" >> $GITHUB_ENV
- name: Run script
run: python .github/Scripts/StoreNotionDB.py
- name: Commit and push changes
run: |
cd $GITHUB_WORKSPACE
git config user.email "[email protected]"
git config user.name "GitHub Actions"
# Check if there are changes to commit
if [[ -n $(git status --porcelain) ]]; then
git add .
git commit -m "Update Notion API data and commit history"
git push origin master
fi
env:
NOTION_TOKEN: ${{ secrets.Notion_Token }}
NOTION_DATABASE_ID: ${{ secrets.Notion_Database_ID }}