|
| 1 | +name: Parse and Commit PEY Job Postings |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "2024" |
| 7 | + |
| 8 | +jobs: |
| 9 | + parse-and-commit: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout the 2024 branch |
| 14 | + uses: actions/checkout@v3 |
| 15 | + with: |
| 16 | + ref: 2024 |
| 17 | + |
| 18 | + - name: Clone the 2024-25 PEY archive repo (shallow clone) |
| 19 | + run: git clone --depth 1 https://github.com/CanadianDesk/2024-25-pey-archive pey-archive |
| 20 | + |
| 21 | + - name: Clone the blog repo (shallow clone) |
| 22 | + run: git clone --depth 1 https://github.com/sadmanca/blog blog-repo |
| 23 | + |
| 24 | + - name: Set up Python |
| 25 | + uses: actions/setup-python@v4 |
| 26 | + with: |
| 27 | + python-version: '3.x' |
| 28 | + |
| 29 | + - name: Cache dependencies |
| 30 | + uses: actions/cache@v3 |
| 31 | + with: |
| 32 | + path: ~/.cache/pip |
| 33 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 34 | + restore-keys: | |
| 35 | + ${{ runner.os }}-pip- |
| 36 | +
|
| 37 | + - name: Install dependencies |
| 38 | + run: pip install -r requirements.txt |
| 39 | + |
| 40 | + - name: Run the parsing script |
| 41 | + run: python parse_folder_to_db.py -v -d "pey-archive/postings" -o "blog-repo/data/PEYJobPosting2024.json" |
| 42 | + |
| 43 | + - name: Configure git for commit |
| 44 | + run: | |
| 45 | + git config --global user.name "github-actions[bot]" |
| 46 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 47 | +
|
| 48 | + - name: Create a new branch if it doesn't exist |
| 49 | + run: | |
| 50 | + cd blog-repo |
| 51 | + git checkout -B github-actions-test |
| 52 | +
|
| 53 | + - name: Commit the new JSON file |
| 54 | + run: | |
| 55 | + cd blog-repo |
| 56 | + git add data/PEYJobPosting2024.json |
| 57 | + git commit -m "Add updated PEY job postings data" |
| 58 | +
|
| 59 | + - name: Push changes to the blog repo |
| 60 | + run: | |
| 61 | + cd blog-repo |
| 62 | + git push -u origin github-actions-test |
| 63 | +
|
| 64 | + - name: Send notification via curl |
| 65 | + run: | |
| 66 | + current_time=$(date) |
| 67 | + curl -d "$current_time" ntfy.sh/sadmanca-uoft-pey-coop-jobs-dashboard-2024-2025 |
0 commit comments