Download services from airtable #97
This file contains hidden or 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: Download services from airtable | |
| on: | |
| schedule: | |
| # Run at midnight UTC every day | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| download-and-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| # Set up Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.x" | |
| # Install requests | |
| - name: Install requests | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests | |
| # Run the Python script | |
| - name: Run download_services_airtable.py | |
| run: python scripts/download_services_airtable.py | |
| # Use the AIRTABLE_API_KEY secret to authenticate with the Airtable API | |
| env: | |
| AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }} | |
| # Configure Git | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: check for changes | |
| run: git status | |
| # Commit and push changes | |
| - name: Commit and push changes | |
| run: | | |
| git add . | |
| git diff-index --quiet HEAD || git commit -m "Update data from Airtable" | |
| git push | |
| env: | |
| # Ensure the GitHub token is available for authentication | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |