Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jemus42 committed Oct 24, 2023
1 parent 8a872ba commit 13d3d8f
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2

updates:
# Keep dependencies for GitHub Actions up-to-date
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
57 changes: 57 additions & 0 deletions .github/workflows/fix-figure-paths.yaml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 7 additions & 1 deletion .github/workflows/update-latex-math.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 13d3d8f

Please sign in to comment.