-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (52 loc) · 1.91 KB
/
build_pr_thesis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: "Build Thesis Document for PR"
on:
pull_request:
paths:
- 'report_thesis/**'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
defaults:
run:
working-directory: report_thesis
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/cache@v3
name: Tectonic Cache
with:
path: ~/.cache/tectonic
key: ${{ runner.os }}-tectonic-${{ hashFiles('**/*.tex') }}
restore-keys: |
${{ runner.os }}-tectonic-
- uses: wtfjoke/setup-tectonic@v2
with:
github-token: ${{ secrets.github_token }}
- name: Run Tectonic
run: tectonic -X build
- name: Upload PDF
id: upload_pdf
uses: actions/upload-artifact@v4
with:
name: thesis-pdf
path: report_thesis/build/thesis/thesis.pdf
- name: Post comment with PDF link
uses: actions/github-script@v6
with:
script: |
const artifactUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/artifacts/${{ steps.upload_pdf.outputs.artifact-id }}`;
const commitHash = context.sha;
const comment = `Built PDF for this PR: [Download PDF](${artifactUrl})\n\nCommit: \`${commitHash}\``;
await github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: comment
});
github-token: ${{ secrets.GITHUB_TOKEN }}