Daily sync of GPML from classic site #265
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "1 day 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}} |