Skip to content

Daily sync of GPML from classic site #733

Daily sync of GPML from classic site

Daily sync of GPML from classic site #733

name: Daily sync of GPML from classic site
on:
workflow_dispatch:
schedule:
- cron: "0 2 * * *"
env:
SYNC_ACTION_VERSION: 2.1
SYNC_ACTION_JAR: SyncAction-${SYNC_ACTION_VERSION}.jar
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@v4
with:
persist-credentials: false
token: ${{ secrets.PICOPAT }}
fetch-depth: 0
ref: main
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
- name: Cache gpml-sync-action
uses: actions/cache@v4
id: cacheSyncJar
with:
path: ./$SYNC_ACTION_JAR
key: cached-gpml-sync-action-${{ hashFiles('$SYNC_ACTION_JAR') }}
restore-keys: |
cached-gpml-sync-action-${{ hashFiles('$SYNC_ACTION_JAR') }}
cached-gpml-sync-action-
- if: steps.cacheSyncJar.outputs.cache-hit != 'true'
name: Install jar
run: |
echo "Cache for $SYNC_ACTION_JAR not found: cached-gpml-sync-action"
if [ ! -e ./$SYNC_ACTION_JAR ]; then
wget -O $SYNC_ACTION_JAR https://github.com/wikipathways/gpml-sync-action/releases/download/v${SYNC_ACTION_VERSION}/SyncAction.jar
fi
- name: Run SyncAction
run: |
chmod 777 $SYNC_ACTION_JAR
SyncDate=$(date --utc +%Y%m%d%H%M%S -d "1 day ago")
echo $SyncDate
java -jar $SYNC_ACTION_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}}