Python Script Workflow #500
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: Python Script Workflow | |
on: | |
push: | |
branches: | |
- main # This triggers the workflow on push to the 'main' branch | |
schedule: | |
- cron: '0 0 * * *' # This schedules the workflow to run at midnight every day | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 # This checks out your repository code | |
- name: Set up Python | |
uses: actions/setup-python@v2 # This sets up Python | |
with: | |
python-version: 3.8 # You can specify the Python version you need | |
- name: Install dependencies | |
run: pip install -r requirements.txt # Install any required packages | |
- name: Set up environment variables | |
run: | | |
echo "NOTION_API_TOKEN=${{ secrets.NOTION_API_TOKEN }}" >> $GITHUB_ENV | |
echo "NOTION_DATABASE_ID=${{ secrets.NOTION_DATABASE_ID }}" >> $GITHUB_ENV | |
env: | |
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} | |
NOTION_API_TOKEN: ${{ secrets.NOTION_API_TOKEN }} | |
- name: Run Python script | |
run: python notion_script.py # Use 'notion_script.py' as the script name | |
env: | |
NOTION_API_TOKEN: ${{ secrets.NOTION_API_TOKEN }} | |
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} |