Skip to content

Commit da5c550

Browse files
committed
Add comment on PR with PDF link
1 parent 91a2576 commit da5c550

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/run.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
permissions:
1010
contents: write
11+
pull-requests: write # Add this for PR comments
1112

1213
# Make sure we only ever run one per branch so we don't have issues pushing
1314
# after running the pipeline
@@ -58,6 +59,26 @@ jobs:
5859
- run: calkit save -am "Run pipeline"
5960
env:
6061
CALKIT_DVC_TOKEN: ${{ secrets.CALKIT_DVC_TOKEN }}
62+
- name: Upload PDF artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: paper-pdf
66+
path: paper/paper.pdf
67+
if-no-files-found: warn
68+
- name: Comment on PR with PDF link
69+
if: github.event_name == 'pull_request'
70+
uses: actions/github-script@v7
71+
with:
72+
script: |
73+
const fs = require('fs');
74+
if (fs.existsSync('paper/paper.pdf')) {
75+
github.rest.issues.createComment({
76+
issue_number: context.issue.number,
77+
owner: context.repo.owner,
78+
repo: context.repo.repo,
79+
body: '📄 **Pipeline completed!** The generated PDF is available as an artifact in this workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
80+
});
81+
}
6182
- name: Save DVC cache
6283
id: cache-dvc-save
6384
uses: actions/cache/save@v4

0 commit comments

Comments
 (0)