-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Paper Add/Update workflows (#460)
Co-authored-by: dvdkouril <[email protected]>
- Loading branch information
Showing
8 changed files
with
1,052 additions
and
127 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
blank_issues_enabled: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: "📚 Add or Update a Paper" | ||
description: "Add or update a paper from Zotero to the HIDIVE website" | ||
labels: ["paper-bot"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
This template is for adding or updating a paper on the HIDIVE website. | ||
Upon submission, a **GitHub Action** will start a **pull request** to update the website with the new paper details. | ||
- type: input | ||
id: zotero_id | ||
attributes: | ||
label: Zotero ID | ||
description: >- | ||
Enter the Zotero ID from either the HIDIVE Lab [preprint collection](https://www.zotero.org/groups/5145258/hidive/collections/AJKTPNSI) | ||
or [publication collection](https://www.zotero.org/groups/5145258/hidive/collections/YGTEVG73). | ||
This ID will be used to automatically fetch all publication details from Zotero. | ||
placeholder: "e.g., D8YCD6QT" | ||
validations: | ||
required: true | ||
|
||
- type: input | ||
id: preprint | ||
attributes: | ||
label: Preprint | ||
description: >- | ||
Enter a Zotero ID or URL for the preprint. **Leave blank if the Zotero ID above is for a preprint**. | ||
placeholder: "e.g., A6ZAJIIA or https://arxiv.org/abs/1234.56789" | ||
|
||
- type: markdown | ||
attributes: | ||
value: | | ||
> [!NOTE] | ||
> Prefer a preprint Zotero ID above if **updating a preprint to a publication**. It will update the existing website entry. | ||
### Optional Fields | ||
The following fields are optional. They can be left blank and updated later if needed. | ||
- type: textarea | ||
id: members | ||
attributes: | ||
label: Lab Members | ||
description: "Tag lab members on paper. See the [lab member](https://github.com/hms-dbmi/gehlenborglab-website/tree/main/_members) directory for available identifiers, one per line." | ||
placeholder: "nils-gehlenborg\nflat-stanley\njane-doe" | ||
|
||
- type: textarea | ||
id: image | ||
attributes: | ||
label: Image | ||
description: "Add an image related to the publication" | ||
placeholder: "Drage and drop or paste an image... (ensure it uploads)" | ||
|
||
- type: input | ||
id: website | ||
attributes: | ||
label: Website | ||
description: "A URL for a website related to the publication" | ||
placeholder: "e.g., https://example.com/publication-website" | ||
|
||
- type: input | ||
id: code | ||
attributes: | ||
label: Code Repository | ||
description: "A link for the code related to the publication" | ||
placeholder: "e.g., https://github.com/username/repo" | ||
|
||
- type: textarea | ||
id: videos | ||
attributes: | ||
label: Video Resources | ||
description: "List video resources related to the publication. Use the format 'Title | URL' for each entry, one per line." | ||
placeholder: "Introduction Video | https://example.com/intro\nConference Presentation | https://example.com/presentation" | ||
|
||
- type: textarea | ||
id: other_resources | ||
attributes: | ||
label: Other Resources | ||
description: "List other resources related to the publication. Use the format 'Title | URL' for each entry, one per line." | ||
placeholder: "Data Repository | https://example.com/data\nSlides | https://example.com/slides" | ||
|
||
- type: textarea | ||
id: awards | ||
attributes: | ||
label: Awards | ||
description: "Enter awards for the publication (one per line)" | ||
placeholder: "Best Paper Award at XXX\nInnovation Prize Y\nMost Cited Paper 2054" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Fetch HIDIVE Papers | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * 1' # Every Monday at 00:00 | ||
|
||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
fetch-papers: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: v1.x | ||
|
||
- name: Fetch HIDIVE Papers | ||
run: deno run -A scripts/fetch-hidive-zotero-items.ts --outdir=assets/papers --issue-file=/tmp/issue-body.md | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
commit-message: Fetch HIDIVE Papers | ||
title: "Update HIDIVE Papers" | ||
branch: hidive-papers | ||
body: "This is an automated pull request to update the HIDIVE papers." | ||
labels: fetch-papers-bot | ||
|
||
- name: Open or Update Missing Papers Issue | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# Check if an issue with the label 'fetch-papers-bot' exists | ||
ISSUE_NUMBER=$(gh issue list --label fetch-papers-bot --limit 1 --json number --jq '.[0].number') | ||
if [ -n "$ISSUE_NUMBER" ]; then | ||
# Update existing issue | ||
gh issue edit $ISSUE_NUMBER --body-file /tmp/issue-body.md | ||
echo "Updated existing issue #$ISSUE_NUMBER" | ||
else | ||
gh issue create --title "Missing HIDIVE Papers" --body-file /tmp/issue-body.md --label fetch-papers-bot | ||
echo "Created new issue for missing papers" | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Update Paper | ||
|
||
on: | ||
issues: | ||
types: [opened, edited] | ||
|
||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
process-issue: | ||
if: contains(github.event.issue.labels.*.name, 'paper-bot') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Parse Issue | ||
id: parse-issue | ||
uses: GrantBirki/[email protected] | ||
with: | ||
body: ${{ github.event.issue.body }} | ||
csv_to_list: false | ||
|
||
- name: Create PR body with Fixes line | ||
run: | | ||
echo "Fixes #${{ github.event.issue.number }}" > /tmp/pr-body.md | ||
echo "" >> /tmp/pr-body.md | ||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: v1.x | ||
|
||
- name: Update Paper | ||
id: output-issue | ||
run: echo ${{ toJson(steps.parse-issue.outputs.json) }} | deno run -A scripts/update-hidive-paper.ts - >> /tmp/pr-body.md | ||
|
||
- name: Extract Zotero ID | ||
id: extract-zotero-id | ||
run: | | ||
ZOTERO_ID=$(echo ${{ toJson(steps.parse-issue.outputs.json) }} | jq -r .zotero_id) | ||
echo "zotero-id=$ZOTERO_ID" >> $GITHUB_OUTPUT | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
commit-message: Update paper | ||
title: "${{ github.event.issue.title }}" | ||
branch: "update-paper-${{ steps.extract-zotero-id.outputs.zotero-id }}" | ||
body-path: /tmp/pr-body.md | ||
labels: paper-bot |
Oops, something went wrong.