-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (61 loc) · 2.11 KB
/
scheduled_gpml_sync.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
name: Daily sync of GPML from classic site
on:
workflow_dispatch:
#schedule:
#- cron: "0 2 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true # to cancel a run if another is triggered
jobs:
classic-sync:
runs-on: ubuntu-latest
steps:
- name: Checkout wikipathways-database repo
uses: actions/checkout@v3
with:
persist-credentials: false
token: ${{ secrets.PICOPAT }}
fetch-depth: 0
ref: main
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
- name: Cache gpml-sync-action
uses: actions/cache@v3
id: cacheSyncJar
with:
path: ./SyncAction.jar
key: cached-gpml-sync-action-${{ hashFiles('SyncAction.jar') }}
restore-keys: |
cached-gpml-sync-action-${{ hashFiles('SyncAction.jar') }}
cached-gpml-sync-action-
- if: steps.cacheSyncJar.outputs.cache-hit != 'true'
name: Install jar
run: |
echo "Cache not found: cached-gpml-sync-action"
if [ ! -e ./SyncAction.jar ]; then
wget -O SyncAction.jar https://github.com/wikipathways/gpml-sync-action/releases/download/v1.0/SyncAction.jar
fi
- name: Run SyncAction
run: |
chmod 777 SyncAction.jar
SyncDate=$(date --utc +%Y%m%d%H%M%S -d "6 hours ago")
echo $SyncDate
java -jar SyncAction.jar $SyncDate
- name: Commit report
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add pathways/WP*/WP*.gpml
if git diff --exit-code --staged; then
echo "No changes"
else
git commit -m 'Process GPML changes'
git pull --rebase
fi
- name: Push as user
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PICOPAT}}