Convert Report to PDF #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Convert Report to PDF | |
on: | |
workflow_dispatch: | |
inputs: | |
report: | |
description: 'Report to convert' | |
required: true | |
type: choice | |
# TODO options to be called from a script or code | |
options: | |
- Aciclovir-Mean | |
- Aciclovir-Mean-SVG | |
- Aciclovir-Population | |
- Raltegravir-Absorption | |
- Raltegravir-Mass-Balance | |
- Test-NO7 | |
- Test-NO8 | |
- Test-NO9 | |
- Test-NO10 | |
- Test-NO11 | |
- Test-NO12 | |
jobs: | |
report-to-pdf: | |
runs-on: ubuntu-latest | |
# Allow only authorized collaborators to trigger GA: | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
# All steps in workflow: | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: Perform html conversion with pandoc | |
run: | | |
pandoc -f markdown -t html5 --embed-resources --standalone \ | |
-o Reports/${{ inputs.report }}/Report.html \ | |
Reports/${{ inputs.report }}/Report.md -c osp.css | |
# Run the HTML to PDF converter action | |
- name: HTML website to PDF converter | |
uses: fifsky/html-to-pdf-action@master | |
with: | |
htmlFile: ./Reports/${{ inputs.report }}/Report.html | |
outputFile: ./Reports/${{ inputs.report }}/Report.pdf | |
pdfOptions: | | |
'{"format": "A4", | |
"margin": {"top": "10mm", "left": "10mm", "right": "10mm", "bottom": "10mm"}, | |
"displayHeaderFooter": true, | |
"footerTemplate": "<span>pageNumber/totalPages</span>" | |
}' | |
- name: Save PDF file as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ inputs.report }}-pdf | |
path: Reports/${{ inputs.report }} |