-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (52 loc) · 1.83 KB
/
choose.yaml
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
name: Random paper
on:
schedule:
- cron: '0 14 * * 5'
workflow_dispatch:
branches: [ main ]
pull_request:
branches: [ main ]
types: [ closed ]
jobs:
choose:
# This workflow runs when:
# "random paper workflow" is enabled and
# (a) Workflow was dispatched manually -or-
# (b) Paper suggestion PR was closed without merging
if: ${{ vars.PAPER_CHOOSE_ON == 1 && (
github.event_name != 'pull_request' ||
(contains(github.event.pull_request.labels.*.name, 'next-paper') &&
!contains(github.event.pull_request.labels.*.name, 'paper-vote') &&
github.event.pull_request.merged == false))}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: 🔮 Choose random paper
run: npm run choose
- name: 📝 Update website
run: npm run web
- name: ✅ Commit paper selection changes
run: bash ${PWD}/.github/utils/commit.sh
- name: 🔎 Lookup paper details
id: vars
run: |
echo "title=$(bash .github/utils/title.sh)" >> $GITHUB_OUTPUT
echo "body=\"$(bash .github/utils/pr.sh)\"" >> $GITHUB_OUTPUT
- name: 🔖️ Create a pull request
uses: peter-evans/create-pull-request@v6
id: paperpr
with:
add-paths: files/*.txt
labels: next-paper
branch: next-paper
title: ${{ steps.vars.outputs.title }}
body: ${{ fromJSON(steps.vars.outputs.body) }}
delete-branch: true
reviewers: ${{ fromJSON(vars.REVIEWERS) }}
- name: 🤖 Enable automatic merge
run: gh pr merge --merge --auto ${{ steps.paperpr.outputs.pull-request-number }}
env:
GH_TOKEN: ${{ secrets.AUTOMERGE_PAT }}