generated from greenelab/lab-website-template
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (67 loc) · 2.04 KB
/
update-citations.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: update-citations
run-name: update citations
on:
# run when called from another workflow
workflow_call:
inputs:
open-pr:
type: boolean
outputs:
changed:
value: ${{ jobs.update-citations.outputs.changed }}
# run if user manually requests it
workflow_dispatch:
permissions:
contents: write
pull-requests: write
env:
FORCE_COLOR: true
GOOGLE_SCHOLAR_API_KEY: ${{ secrets.GOOGLE_SCHOLAR_API_KEY }}
jobs:
update-citations:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
# for debugging
- name: Print contexts
uses: crazy-max/ghaction-dump-context@v1
- name: Checkout branch contents
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "**/requirements.txt"
- name: Install Python packages
run: |
python -m pip install --upgrade --requirement ./_cite/requirements.txt
- name: Build updated citations
run: python _cite/cite.py
timeout-minutes: 15
- name: Check if citations changed
id: changed
uses: tj-actions/verify-changed-files@v13
with:
files: |
_data/citations.yaml
- name: Commit updated citations to branch
if: |
steps.changed.outputs.files_changed == 'true' &&
inputs.open-pr != true
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Update citations"
- name: Open pull request with updated citations
if: |
steps.changed.outputs.files_changed == 'true' &&
inputs.open-pr == true
uses: peter-evans/create-pull-request@v4
with:
branch: citation-update
title: Periodic citation update
outputs:
changed: ${{ steps.changed.outputs.files_changed }}