Scrape Demographic Income Data for Non-Permanent Residents #312
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: Scrape Demographic Income Data for Non-Permanent Residents | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # Daily at 8:23 AM UTC | |
| - cron: "23 8 * * *" | |
| # For hourly at 42 minutes past the hour: '42 * * * *' | |
| permissions: | |
| contents: write | |
| env: | |
| STATS_CAN_URL: https://www150.statcan.gc.ca/t1/tbl1/en/dtl!downloadDbLoadingData-nonTraduit.action?pid=1110009101&latestN=2&startDate=&endDate=&csvLocale=en&selectedMembers=%5B%5B1%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B5%5D%5D&checkedLevels=1D1%2C1D2%2C1D3%2C2D1%2C3D1 | |
| COMMIT_MSG: Update Demographic Income Data for Non-Permanent Residents | |
| jobs: | |
| scrape: | |
| runs-on: ubuntu-latest | |
| if: ${{ !github.event.repository.is_template }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run the scraper | |
| run: | | |
| python scrape.py '${{ env.STATS_CAN_URL }}' metrics/statscan/demographic-incomes.json "Income concept" "Demographic characteristics" | |
| # Commit as brendan so vercel will deploy it | |
| - name: Commit and push | |
| run: |- | |
| git config user.name "Automated" | |
| git config user.email "brendan@brendansamek.com" | |
| git add -A | |
| timestamp=$(date -u) | |
| git commit -m "${{ env.COMMIT_MSG }} - ${timestamp}" || exit 0 | |
| git pull --rebase | |
| git push |