Skip to content

Delete datasets/oneoff/13-1.cgel #62

Delete datasets/oneoff/13-1.cgel

Delete datasets/oneoff/13-1.cgel #62

Workflow file for this run

# add .tex conversion and (and .pdf rendering of .tex file) to a pull request that adds/modifies a cgel tree.
# currently assumes cgel file(s) in datasets/oneoff.
name: Create tree .tex and .pdf
on:
push:
paths:
- datasets/oneoff/*.cgel
branches-ignore:
- main
jobs:
render:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
submodules: true
- name: Update to make sure we have a newly created branch
run: |
git branch -v
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# https://github.com/Ana06/get-changed-files/releases/tag/v1.2
- uses: Ana06/get-changed-files@25f79e676e7ea1868813e21465014798211fad8c
id: files
with:
format: space-delimited
- name: Config github actions bot
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Cache CGEL Dependencies
id: cache-cgel
uses: actions/cache@v3
with:
#cgel cache files are stored in `~/.cache/cgel`
path: ~/.cache/cgel
key: ${{ runner.os }}-cgel-${{ hashFiles('**/cgel/requirements.txt') }}
restore-keys: |
${{ runner.os }}-cgel-
- if: ${{ steps.cache-cgel.outputs.cache-hit != 'true' }}
name: Install CGEL packages
continue-on-error: true
run: pip install -r cgel/requirements.txt
# - name: Install cgel dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r cgel/requirements.txt
- name: Cache LaTeX
id: cache-latex
uses: actions/cache@v3
with:
path: ~/.cache/texworks
key: ${{ runner.os }}-latex-test
restore-keys: |
${{ runner.os }}-latex-
- if: ${{ steps.cache-latex.outputs.cache-hit != 'true' }}
name: Install texlive
continue-on-error: true
run: sudo apt-get install texlive-latex-extra
# - name: Install texlive
# run: sudo apt-get install texlive-latex-extra
- name: Generate .tex and .pdf files
run: |
mkdir -p datasets/oneoff/tex
mkdir -p datasets/oneoff/pdf
for changed_file in ${{ steps.files.outputs.added_modified }}; do
if [[ "$changed_file" == **.cgel ]]; then
filename=$(basename "$changed_file")
tree_name="${filename%.cgel}"
# make .tex
python cgel/tree2tex.py "${changed_file}" > "datasets/oneoff/tex/$tree_name.tex"
# make .pdf
pdflatex -output-directory=datasets/oneoff/pdf "datasets/oneoff/tex/$tree_name.tex"
fi
done
- name: Commit and push .tex and .pdf files
run: |
for changed_file in ${{ steps.files.outputs.added_modified }}; do
if [[ "$changed_file" == **.cgel ]]; then
filename=$(basename "$changed_file")
tree_name="${filename%.cgel}"
git add "datasets/oneoff/tex/$tree_name.tex"
git add "datasets/oneoff/pdf/$tree_name.pdf"
git commit -m "generated tex and pdf files for $filename"
fi
done
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}