Timetable scrape #2336
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: Timetable scrape | |
# Controls when the workflow will run | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '0 */8 * * *' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
scrape: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
- name: Configure git | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- name: Update packages | |
run: sudo apt-get update | |
- name: Install poppler-utils | |
run: sudo apt-get install poppler-utils | |
- name: Run the scraper | |
working-directory: ./src | |
run: "./scraper.sh ${{ github.event_name }}" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: master | |
- name: Check file existence | |
id: check_file | |
uses: andstor/file-existence-action@v1 | |
with: | |
files: "src/bgschoolbot-need-update" | |
- name: Update BgSchoolBot database | |
if: steps.check_file.outputs.files_exists == 'true' | |
uses: wei/curl@master | |
with: | |
args: "https://bgschool.cristianlivella.com/gh-actions/update.php?token=${{ secrets.BGSCHOOLBOT_TOKEN }}" |