From 77a93ec40d75d29e5d1e38b0ba8a244c64cdd9af Mon Sep 17 00:00:00 2001 From: Ashley Chiu Date: Fri, 6 Sep 2024 16:22:27 -0700 Subject: [PATCH] add debugging message to get the full path --- .github/workflows/generate-pdf.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate-pdf.yml b/.github/workflows/generate-pdf.yml index 9628552..26896ca 100644 --- a/.github/workflows/generate-pdf.yml +++ b/.github/workflows/generate-pdf.yml @@ -39,7 +39,7 @@ jobs: - name: Convert HTML to PDF and merge them run: | - site_folder="$PWD/_site" + site_folder="_site" output_folder="pdf_output" combined_pdf="textbook_full.pdf" @@ -54,7 +54,16 @@ jobs: for html_file in "${file_list[@]}"; do full_path="$site_folder/$html_file" output_pdf="$output_folder/$(basename "$html_file" .html).pdf" - google-chrome --headless --disable-gpu --disable-software-rasterizer --no-sandbox --no-pdf-header-footer --print-to-pdf="$output_pdf" "file://$PWD/$full_path" + + echo "file://$PWD/$full_path" + + if [ -f "$full_path" ]; then + echo "Generating PDF for $html_file" + google-chrome --headless --disable-gpu --disable-software-rasterizer --no-sandbox --no-pdf-header-footer --print-to-pdf="$output_pdf" "file://$PWD/$full_path" + else + echo "Error: File $full_path not found!" >&2 + exit 1 + fi done pdfunite "$output_folder"/*.pdf "$PWD/$combined_pdf" @@ -63,7 +72,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: textbook-full - path: $PWD/textbook_full.pdf + path: textbook_full.pdf - name: Commit and push changes only on push if: github.event_name == 'push'