-
Notifications
You must be signed in to change notification settings - Fork 20
68 lines (68 loc) · 3.06 KB
/
draft-paper.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Draft paper
on:
workflow_dispatch:
inputs:
repository_url:
description: 'URL of the repository containing the paper file'
required: true
branch:
description: 'Git branch where the paper Markdown file is'
required: false
issue_id:
description: 'The issue number of the submission in the JOSS reviews repo'
required: true
issue_title:
description: 'The issue title associated with the JOSS review'
required: true
jobs:
pdf-generation:
name: ${{ format('PDF draft for issue {0}', github.event.inputs.issue_id) }}
runs-on: ubuntu-latest
env:
GH_ACCESS_TOKEN: ${{ secrets.BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GH_REPO: openjournals/joss-reviews
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- name: Compile Paper
id: generate-files
uses: xuanxu/paper-action@main
with:
repository_url: ${{ github.event.inputs.repository_url }}
branch: ${{ github.event.inputs.branch }}
issue_id: ${{ github.event.inputs.issue_id }}
journal: joss
- name: Upload PDF file to papers repo
id: upload-pdf
uses: xuanxu/upload-files-action@main
with:
papers_repo: openjournals/joss-papers
branch_prefix: joss
issue_id: ${{ github.event.inputs.issue_id }}
pdf_path: ${{ steps.generate-files.outputs.pdf_path}}
- name: Reply message
if: ${{ success() }}
run: |
gh issue comment ${{ github.event.inputs.issue_id }} --body ":point_right::page_facing_up: [Download article proof](${{ steps.upload-pdf.outputs.pdf_download_url}}) :page_facing_up: [View article proof on GitHub](${{ steps.upload-pdf.outputs.pdf_html_url}}) :page_facing_up: :point_left:"
- name: Error message
if: ${{ failure() }}
run: |
gh issue comment ${{ github.event.inputs.issue_id }} --body ":warning: [An error happened when generating the pdf](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}?check_suite_focus=true). ${{ env.CUSTOM_ERROR }}"
- name: Checkout code
if: ${{ steps.generate-files.outcome == 'success' && startsWith(github.event.inputs.issue_title, '[PRE REVIEW]') }}
uses: actions/checkout@v4
with:
path: papers-embeddings
sparse-checkout: .
- name: Find most similar paper
if: ${{ steps.generate-files.outcome == 'success' && startsWith(github.event.inputs.issue_title, '[PRE REVIEW]') }}
id: find-similar-papers
continue-on-error: true
uses: openjournals/find-similar-papers@main
with:
pdf_path: ${{ steps.generate-files.outputs.pdf_path}}
- name: Post recommendations
if: ${{ steps.find-similar-papers.outcome == 'success' && startsWith(github.event.inputs.issue_title, '[PRE REVIEW]') }}
continue-on-error: true
run: |
gh issue comment ${{ github.event.inputs.issue_id }} --body '${{ steps.find-similar-papers.outputs.recommendations}}'