diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..28be3a99 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 + +updates: + # Keep dependencies for GitHub Actions up-to-date + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/fix-figure-paths.yaml b/.github/workflows/fix-figure-paths.yaml new file mode 100644 index 00000000..1d85ff36 --- /dev/null +++ b/.github/workflows/fix-figure-paths.yaml @@ -0,0 +1,57 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Source version of this workflow lives in https://github.com/slds-lmu/lecture_service +# Please only update by copying from there to avoid divergences +on: + workflow_dispatch: + push: + branches: [main, master] + +name: fix-figure-paths + +jobs: + fix-figure-paths: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + # 0 indicates all history for all branches and tags, 1 is shallow (and default) + fetch-depth: 1 + + # Uncomment / move to get a tmux ssh session for interactive debugging + # - name: Setup tmate session + # uses: mxschmitt/action-tmate@v3 + + - name: Fix figure paths in-place + run: | + sed -i -E "s\slides/[a-z-]+/figure\figure\g" $(find slides -iname "*.tex") + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + title: "[Automated] Fix relative figure paths in slides/" + commit-message: "Fix figure paths" + body: | + Automated changes by `fix-figure-paths.yaml` workflow. + Compare and merge to keep figure paths compatible with compilation outside of overleaf. + + ## Explanation: + + From what I understand, overleaf automatically tab-completes image paths relative to the project root, e.g. + `slides/supervised-regression/figure/nutshell-regression-poly-plot-1.pdf` - which is apparently fine on overleaf + but causes errors when trying to compile slides locally, where paths relative to the folder containing the + `.tex` file are required (i.e. `figure/nutshell-regression-poly-plot-1.pdf`). + + As far as I understand it the latter path should also work on overleaf. + To locally auto-fix this, the following command can be used on Linux: + + ```sh + sed -i -E "s\slides/[a-z-]+/figure\figure\g" $(find slides -iname "*.tex") + ``` + + Which is exactly what this workflow does. + Note that macOS requires `gnu-sed` as the default BSD `sed` behaves differently. + branch: fix-figure-paths + add-paths: slides diff --git a/.github/workflows/update-latex-math.yaml b/.github/workflows/update-latex-math.yaml index a0bac431..91726fdf 100644 --- a/.github/workflows/update-latex-math.yaml +++ b/.github/workflows/update-latex-math.yaml @@ -19,15 +19,21 @@ jobs: with: # 0 indicates all history for all branches and tags, 1 is shallow (and default) fetch-depth: 1 - + # Uncomment / move to get a tmux ssh session for interactive debugging # - name: Setup tmate session # uses: mxschmitt/action-tmate@v3 + # 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 - 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 + # 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@v5 with: