Skip to content

Commit

Permalink
Sync branch with NYPL. (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen authored Jun 24, 2021
1 parent d488528 commit 82f55b7
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Sync branch with NYPL
on:
schedule:
- cron: '0 7 * * *'

workflow_dispatch:

jobs:
sync_with_nypl:
runs-on: ubuntu-latest

env:
REMOTE_ORG: NYPL-Simplified
REMOTE_REPO: registry_admin
REMOTE_BRANCH: master
LOCAL_BRANCH: nypl/master

steps:
- name: Checkout local branch
uses: actions/checkout@v2
with:
ref: ${{ env.LOCAL_BRANCH }}

- name: Fetch remote repo
id: fetch
run: |
git remote add upstream https://github.com/${{ env.REMOTE_ORG }}/${{ env.REMOTE_REPO }}.git
git fetch upstream ${{ env.REMOTE_BRANCH }}
echo "::set-output name=LOCAL_COMMIT::$(git rev-parse refs/heads/${{ env.LOCAL_BRANCH }})"
echo "::set-output name=REMOTE_COMMIT::$(git rev-parse refs/remotes/upstream/${{ env.REMOTE_BRANCH }})"
- name: Sync
if: steps.fetch.outputs.LOCAL_COMMIT != steps.fetch.outputs.REMOTE_COMMIT
run: |
git pull --no-edit --ff-only upstream ${{ env.REMOTE_BRANCH }}
git push origin ${{ env.LOCAL_BRANCH }}

0 comments on commit 82f55b7

Please sign in to comment.