-
Notifications
You must be signed in to change notification settings - Fork 15
88 lines (78 loc) · 2.38 KB
/
on_citedin_change.yml
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
85
86
87
88
name: When citation added, update frontmatter
on:
workflow_dispatch:
push:
branches:
- main
paths:
- downstream/citedin_lookup.yml
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
frontmatter:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
ref: main
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install deps
run: |
pip install python-frontmatter
- name: Update citedin in frontmatter .md files
run: |
python ./scripts/update_frontmatter_citedin.py
- name: Commit report
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add pathways/*/*.md
if git diff --exit-code --staged; then
echo "No changes"
else
git commit -m 'Update citedin in frontmatter .md files'
git pull --rebase
git push
fi
copy-to-site-repo:
runs-on: ubuntu-latest
needs: [frontmatter]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: wikipathways-database
submodules: true
fetch-depth: 0
ref: main
- name: Checkout jekyll repo
uses: actions/checkout@v4
with:
repository: wikipathways/wikipathways.github.io
path: wikipathways.github.io
submodules: true
fetch-depth: 0
ref: main
ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
- name: Commit report
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
cp wikipathways-database/pathways/*/*.md wikipathways.github.io/_pathways/
cd wikipathways.github.io
git add _pathways/*.md
if git diff --exit-code --staged > /dev/null; then
echo "No changes"
else
git diff --name-only
git commit -m 'Update citedin in frontmatter .md files'
git pull --rebase
git push
fi