update-latex-math #34
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
# Source version of this workflow lives in https://github.com/slds-lmu/lecture_service/service/.github/workflows | |
# Please only update by copying from there to avoid divergences | |
on: | |
# Allow manually triggering the workflow via GitHub website, gh CLI tool etc. | |
# Also adds parameter to enable tmate (inetractive tmux session for debugging) | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
# Run this workflow regularly just in case there are upstream changes that would be missed otherwise | |
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule | |
schedule: | |
# See https://crontab.guru for a cron helper | |
# * is a special character in YAML so you have to quote this string | |
- cron: '30 6 * * *' | |
push: | |
# Activate on pushes to both the main or master branches (inconsistently used across lecture repos) | |
branches: [main, master] | |
name: update-latex-math | |
jobs: | |
update-latex-math: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
# 0 indicates all history for all branches and tags, 1 is shallow (and default) | |
fetch-depth: 1 | |
# Don't show progress bar, very verbose for large repos | |
show-progress: false | |
# Get a tmux ssh session for interactive debugging | |
# Controlled via inputs from GitHub webinterface | |
# See https://github.com/mxschmitt/action-tmate | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
# 1. Delete latex-math contents in the current lecture to make sure that outdated files are removed | |
# (example: there was an iml.tex that was superseded by ml-interpretable.tex) | |
# 2. Download latex-math from the canonical repo into ./latex-math | |
# 3. Delete latex-math.pdf etc to avoid dragging large binary blobs through the git history | |
- name: Get latex-math | |
run: | | |
rm -rf latex-math/* | |
curl -sL https://api.github.com/repos/slds-lmu/latex-math/tarball/master | tar -xz --directory=latex-math/ --strip-components=1 | |
rm latex-math/latex-math.pdf | |
rm latex-math/latex-math.Rmd | |
rm -r latex-math/.github | |
# Use this pull request action to auto-generate a PR with the changes | |
# See https://github.com/peter-evans/create-pull-request#action-inputs | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
title: "[Automated] Update latex-math" | |
commit-message: "Update latex-math" | |
body: | | |
Automated changes by `update-latex-math.yaml` workflow. | |
Compare and merge to keep `./latex-math/` up to date with upstream [`slds-lmu/latex-math`](slds-lmu/latex-math). | |
This branch will automatically be updated on subsequent commits. | |
branch: update-latex-math | |
add-paths: latex-math |