Save finals schedule PDFs #10449
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: Save finals schedule PDFs | |
on: | |
schedule: | |
- cron: '0 * * * *' | |
workflow_dispatch: | |
jobs: | |
get-files: | |
name: Get link from Registrars website and download it | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v3 | |
- name: Get files | |
run: | | |
curl -Lso registrar_grades.html 'https://info.rpi.edu/registrar/grades' | |
grep -ie '[^"]*box\.com[^"]*' registrar_grades.html | while read -r link; do | |
LINK1="$(echo "$link" | grep -oie '[^"]*box\.com[^"]*')" | |
LINK2="$(echo "$LINK1" | sed 's/\/s\//\/public\/static\//')" | |
TITLE="$(curl -Ls $LINK1 | grep -oie 'meta property="og:title" content="[^|]*' | cut -d\" -f4)" | |
TITLE="${TITLE%?}" | |
curl -Lo "$TITLE" "$LINK2" && echo "Downloaded $TITLE ($LINK1)" || echo "Failed to download $TITLE ($LINK1)" || true | |
done | |
- name: Commit files | |
run: | | |
git config user.name "Quatalog Updater" && git config user.email "[email protected]" | |
git add *.pdf registrar_grades.html | |
git commit -m "$(date -u)" || exit 0 | |
git push |