Skip to content

Make commit conditional on new changes #21

Make commit conditional on new changes

Make commit conditional on new changes #21

name: 'Push plots to Overleaf'
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Overleaf project
run: |
cd ${{ github.workspace }}
cd ..
git clone ${{ secrets.OVERLEAF_GIT_CLONE_URL }} overleaf/
pwd
ls -lah
- name: Checkout python project on Github
uses: actions/checkout@v4
- name: Cache dependency
id: cache-dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
cd ${{ github.workspace }}
python3 -m pip install --upgrade pip
pip install -e ".[docs]"
- name: Run experiments and generate plots
run: |
cd ${{ github.workspace }}
python3 labproject/run.py
cd ..
pwd
ls -lah
ls -lah labproject/
cp labproject/plots/* overleaf/figures/
- name: Setup overleaf git and add changes
run: |
cd ${{ github.workspace }}
cd ../overleaf/
git config --global user.name "Github Actions"
git config --global user.email ""
git add figures/
- name: Commit and push changes to Overleaf if new figures were produced
if: ${{ git diff --cached --exit-code }}

Check failure on line 50 in .github/workflows/push_to_overleaf.yml

View workflow run for this annotation

GitHub Actions / Push plots to Overleaf

Invalid workflow file

The workflow is not valid. .github/workflows/push_to_overleaf.yml (Line: 50, Col: 13): Unrecognized named-value: 'git'. Located at position 1 within expression: git diff --cached --exit-code
run: |
git commit -m "Update figures automatically"
git push