generated from greenelab/lab-website-template
-
Notifications
You must be signed in to change notification settings - Fork 5
84 lines (69 loc) · 2.11 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
82
83
84
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
- uses: crazy-max/ghaction-dump-context@v2
- name: Checkout branch contents
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
- name: Setup Python
uses: actions/setup-python@v5
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
# for debugging
- if: runner.debug == '1'
uses: mxschmitt/action-tmate@v3
- 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@v18
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@v5
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@v6
with:
branch: citation-update
title: Periodic citation update
outputs:
changed: ${{ steps.changed.outputs.files_changed }}