-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: github workflow for caching parishes (#30) * chore(README): badges for workflow * chore: update README * chore: bump version from 0.4.1 to 0.4.2
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# This workflow runs the scraper once a week within GitHub's Workflow . | ||
# It scrapes the parishes and pushes the compressed file into the branch /cache/parishes | ||
|
||
name: Cache Parishes | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 3 * * 1" # every Monday 03:00 UTC am | ||
env: | ||
# TEMPORARY: use this version as long as <= 1.x to prevent breaking anything | ||
MOS_VERSION: v0.4.1 # matricula-online-scraper version | ||
|
||
jobs: | ||
cache-parishes: | ||
name: Cache Parishes | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: cache/parishes | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
check-latest: true | ||
- run: python -m pip install --upgrade pip | ||
# Install this tool from pypi instead of building it from source | ||
- name: Install from PyPi | ||
run: pip install matricula-online-scraper==$MOS_VERSION | ||
- name: Scrape parishes | ||
run: matricula-online-scraper fetch location "parishes" -e csv # -> 'parishes.csv' | ||
- name: Zip file | ||
run: gzip parishes.csv # -> 'parishes.csv.gz' | ||
- name: Push to branch 'cache/parishes' | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git add parishes.csv.gz | ||
git commit -m "cache parishes" | ||
git push |
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
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