Skip to content

test

test #82

Workflow file for this run

name: Scraper
on:
# schedule:
# - cron: '0 5 * * MON'
# workflow_dispatch:
push:
branches:
- gh-app
jobs:
scrape:
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.SCRAPER_APP_ID }}
private-key: ${{ secrets.SCRAPER_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run scraper
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
echo test > db/data/scraped_optional_subjects.yml
git add db/data
if ! git diff --cached --quiet;
then
git config --global user.email "[email protected]"
git config --global user.name "MiCarrera"
git commit -m 'chore: update scraped subjects data'
git push -f origin HEAD:scraper2
if [ $(gh pr list --head scraper2 --json title --jq 'length') == '0' ];
then
gh pr create \
--title "Update scraped subjects data" \
--body "This PR runs `rails scraper` to update scraped subjects' data" \
--head scraper2
else
echo "A PR already exists and was correctly updated."
fi
else
echo "There were no changes. Nothing to do."
fi