Set paper #1
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
name: Set suggestion | |
on: | |
workflow_dispatch: | |
branches: [ main ] | |
inputs: | |
doi: | |
description: DOI, e.g. 10.1122/9991234 | |
required: true | |
jobs: | |
set_paper: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: 'main' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Set paper from input | |
run: | | |
npm run set -- ${{ github.event.inputs.doi }} | |
npm run web | |
- name: Get selection details | |
id: vars | |
run: | | |
echo "title=$(sed -n '1p' ./data/desc.txt)" >> $GITHUB_OUTPUT && | |
echo "mla=$(sed -n '2p' ./data/desc.txt)" >> $GITHUB_OUTPUT && | |
echo "abs=$(sed -n '3p' ./data/desc.txt)" >> $GITHUB_OUTPUT && | |
echo "doi=$(cat ./data/next.txt)" >> $GITHUB_OUTPUT && | |
echo "NOW=$(date +'%d %B')" >> $GITHUB_ENV | |
- name: Create commit | |
run: | | |
git config user.name 'Bot' | |
git config user.email '[email protected]' | |
git add -A | |
git commit -m "Next paper $NOW" | |
- name: Create Pull Request | |
id: paperpr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
add-paths: files/*.txt | |
labels: next-paper | |
branch: next-paper | |
delete-branch: true | |
title: ${{ steps.vars.outputs.title }} | |
body: | | |
This paper was randomly selected as your next reading. | |
### ${{ steps.vars.outputs.title }} | |
${{ steps.vars.outputs.abs }} | |
> ${{ steps.vars.outputs.mla }} | |
**Merge this PR to apply selection.** | |
reviewers: ${{ fromJSON(vars.REVIEWERS) }} | |
- name: Enable PR Automerge | |
if: steps.paperpr.outputs.pull-request-operation == 'created' | |
uses: peter-evans/enable-pull-request-automerge@v2 | |
with: | |
token: ${{ secrets.AUTOMERGE_PAT }} | |
pull-request-number: ${{ steps.paperpr.outputs.pull-request-number }} | |
merge-method: squash |