Update update-blog.yml #2
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: Parse and Commit PEY Job Postings | |
on: | |
push: | |
branches: | |
- "2024" | |
workflow_dispatch: | |
jobs: | |
parse-and-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the 2024 branch | |
uses: actions/checkout@v3 | |
with: | |
ref: 2024 | |
- name: Clone the 2024-25 PEY archive repo (shallow clone) | |
run: git clone --depth 1 https://github.com/CanadianDesk/2024-25-pey-archive pey-archive | |
- name: Clone the blog repo (shallow clone) | |
run: git clone --depth 1 https://github.com/sadmanca/blog blog-repo | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Run the parsing script | |
run: python parse_folder_to_db.py -v -d "pey-archive/postings" -o "blog-repo/data/PEYJobPosting2024.json" | |
- name: Configure git for commit | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Create a new branch if it doesn't exist | |
run: | | |
cd blog-repo | |
git checkout -B github-actions-test | |
- name: Commit the new JSON file | |
run: | | |
cd blog-repo | |
git add data/PEYJobPosting2024.json | |
git commit -m "Add updated PEY job postings data" | |
- name: Push changes to the blog repo | |
run: | | |
cd blog-repo | |
git push -u origin github-actions-test | |
- name: Send notification via curl | |
run: | | |
current_time=$(date) | |
curl -d "$current_time" ntfy.sh/sadmanca-uoft-pey-coop-jobs-dashboard-2024-2025 |