Update Generated GitHub Preview #110
This file contains hidden or 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: Update Generated GitHub Preview | |
| on: | |
| # scheduled | |
| schedule: | |
| # every day at 17:30 UTC | |
| - cron: "30 17 * * *" | |
| # triggered manually | |
| workflow_dispatch: | |
| jobs: | |
| sync_lecture: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout our semester-repo | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Checkout external lecture-repo (_gfm branch) | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: Programmiermethoden-CampusMinden/PM-Lecture ## TODO (org/repo) | |
| fetch-depth: 0 | |
| ref: _s23 ## TODO (branch) | |
| path: _gfm | |
| - name: Retrieve last commit message from lecture-repo | |
| id: message | |
| run: | | |
| cd _gfm/ | |
| msg="$(git log -n 1 --pretty=reference | sed -e 's/["\\$$`]//g' -e "s/'//g")" | |
| echo "COMMIT_MESSAGE=$msg" >> "$GITHUB_OUTPUT" | |
| cd .. | |
| - name: Copy files over | |
| run: | | |
| rm -rf admin/ lecture/ homework/ | |
| cp -r _gfm/* . | |
| rm -rf _gfm/ | |
| - name: Commit and push | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| git config user.name "cagix" | |
| git config user.email "[email protected]" | |
| git add -f . | |
| git commit -m '${{ steps.message.outputs.COMMIT_MESSAGE }}' | |
| git push | |
| else | |
| echo "no changes to push" | |
| fi |