Fall edits #81
Workflow file for this run
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: Choose paper | |
on: | |
schedule: | |
# ┌─────────── minute (0 - 59) | |
# │ ┌────────── hour (0 - 23) | |
# │ │ ┌────────── day of the month (1 - 31) | |
# │ │ │ ┌────────── month (1 - 12 or JAN-DEC) | |
# │ │ │ │ ┌────────── day of the week (0 - 6 or SUN-SAT) | |
# │ │ │ │ │ | |
# │ │ │ │ │ | |
# │ │ │ │ │ | |
# * * * * * | |
- cron: '0 17 * * 5' | |
workflow_dispatch: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
types: [ closed ] | |
jobs: | |
choose: | |
if: ${{ vars.PAPER_CHOOSE_ON == 1 && ( | |
github.event_name != 'pull_request' || | |
(contains(github.event.pull_request.labels.*.name, 'next-paper') && | |
github.event.pull_request.merged == false) | |
)}} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: 'main' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Run chooser | |
run: | | |
npm run choose | |
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) }} | |
nkrusch | |
phanukaev | |
- 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 |