Run Notion API Script #30
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: 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 }} |