Skip to content

Include license (number 5) #111

Include license (number 5)

Include license (number 5) #111

Workflow file for this run

name: Compile LaTeX PDF
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
container:
image: texlive/texlive:latest
steps:
- uses: actions/checkout@v3
- name: Compile Document
run: latexmk -pdfxe ctufit-thesis.tex
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: thesis-dobryjak
path: out/ctufit-thesis.pdf
comment_artifact:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
contents: read
actions: read
issues: write
pull-requests: write
steps:
- name: Delete previous comments
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issue_number = context.payload.pull_request.number;
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
});
const botComments = comments.data.filter(comment => comment.user.login === 'github-actions[bot]');
for (const comment of botComments) {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
});
}
# - name: Fetch Artifact Download URL
# id: fetch_artifact
# uses: actions/github-script@v5
# with:
# github-token: ${{secrets.GITHUB_TOKEN}}
# script: |
# const artifactResponse = await github.rest.actions.listWorkflowRunArtifacts({
# owner: context.repo.owner,
# repo: context.repo.repo,
# run_id: ${{github.run_id}}
# });
# if (artifactResponse.data.artifacts.length > 0) {
# const artifactUrl = artifactResponse.data.artifacts[0].archive_download_url;
# core.setOutput('artifact_url', artifactUrl); // Set the output for later use
# } else {
# throw new Error('No artifacts found.');
# }
# Step to comment the link to the artifacts on PR
- name: Comment PR with Artifact Link
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
// const artifactUrl = `${{steps.fetch_artifact.outputs.artifact_url}}`; // Use the output from the previous step
const artifactUrl = `https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}`;
const prComment = `The compiled PDF can be found here: [Download PDF](${artifactUrl})`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: prComment
});