Skip to content

Update usc-rule2002a.cgel #19

Update usc-rule2002a.cgel

Update usc-rule2002a.cgel #19

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
# 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: Install cgel dependencies
run: |
python -m pip install --upgrade pip
pip install -r cgel/requirements.txt
- 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 }}