Skip to content

Commit

Permalink
[fix] textbook pdf missing in push (#93)
Browse files Browse the repository at this point in the history
* check if textbook pdf is missing

* test opening a PR - is textbook_full still missing?

* check git status

* textbook_full is not missing, test with force add?

* remove numbering.* from gitignore to yml

* push specifically the new updated branch

* add git stat check

* renormalize the file

* add logging to remote branch

* fix checkout command

* update version of create PR

* git log after attempting to make a pr

* test if we modify the content

* remove create pr portion of github action
  • Loading branch information
ashmchiu authored Sep 9, 2024
1 parent 539f457 commit 7309120
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/generate-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,28 +167,33 @@ jobs:
run: |
rm -rf pdf_output
rm -rf pdf_numbering_output
rm -rf textbook_full_original.pdf
rm -rf textbook_full_cpy.pdf
rm textbook_full_original.pdf
rm textbook_full_cpy.pdf
rm numbering.pdf
rm numbering.aux
- name: Check if PDF files are created
run: |
if [ -f "textbook_full.pdf" ]; then echo "textbook_full.pdf here"; else echo "textbook_full.pdf gone"; fi
- name: Check git status
run: git status

- name: Check git diff
run: git diff --stat

- name: Commit changes to a new branch
if: github.event_name == 'push' && !contains(github.event.head_commit.message, 'Update PDF of textbook')
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Actions"
git checkout -b update-textbook-full-pdf
git add textbook_full.pdf
git add -f textbook_full.pdf
git commit -m "Update PDF of textbook on site after a merge to main"
git push origin HEAD
git push -f origin update-textbook-full-pdf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create a Pull Request
if: github.event_name == 'push' && !contains(github.event.head_commit.message, 'Update PDF of textbook')
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update PDF of textbook on site"
branch: update-textbook-full-pdf
title: "Update full PDF of textbook"
body: "This PR updates the full PDF of the textbook."
base: main
- name: Check git log on update-textbook-full-pdf branch
run: |
git checkout update-textbook-full-pdf
git log
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,6 @@ $RECYCLE.BIN/

# PDF Page Numbering
pdf-generation/numbering.aux
numbering.aux
numbering.pdf
textbook_full_cpy.pdf
textbook_full_original.pdf
pdf-generation/numbering.fdb_latexmk
pdf-generation/numbering.fls
pdf-generation/numbering.log
Expand Down

0 comments on commit 7309120

Please sign in to comment.