From 0d3350835c8d9feffb170a3cb3996a616dedf1c4 Mon Sep 17 00:00:00 2001 From: kaleofduty <59616916+kaleofduty@users.noreply.github.com> Date: Wed, 29 Apr 2020 15:58:09 +0200 Subject: [PATCH] Github action to sync develop branch from smartcontractkit/chainlink every 30 minutes --- ...evelop-from-smartcontractkit-chainlink.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/sync-develop-from-smartcontractkit-chainlink.yml diff --git a/.github/workflows/sync-develop-from-smartcontractkit-chainlink.yml b/.github/workflows/sync-develop-from-smartcontractkit-chainlink.yml new file mode 100644 index 00000000000..be5f9ae29b6 --- /dev/null +++ b/.github/workflows/sync-develop-from-smartcontractkit-chainlink.yml @@ -0,0 +1,30 @@ +name: Sync develop from smartcontractkit/chainlink + +on: + schedule: + # * is a special character in YAML so you have to quote this string + - cron: '*/30 * * * *' + + +jobs: + sync: + name: Sync + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: develop + if: env.GITHUB_REPOSITORY != 'smartcontractkit/chainlink' + - name: Sync + run: | + git remote add upstream "https://github.com/smartcontractkit/chainlink.git" + COMMIT_HASH_UPSTREAM=$(git ls-remote upstream develop | grep -P '^[0-9a-f]{40}\trefs/heads/develop$' | cut -f 1) + COMMIT_HASH_ORIGIN=$(git ls-remote origin develop | grep -P '^[0-9a-f]{40}\trefs/heads/develop$' | cut -f 1) + if [ "$COMMIT_HASH_UPSTREAM" = "$COMMIT_HASH_ORIGIN" ]; then + echo "Both remotes have develop at $COMMIT_HASH_UPSTREAM. No need to sync." + else + echo "upstream has develop at $COMMIT_HASH_UPSTREAM. origin has develop at $COMMIT_HASH_ORIGIN. Syncing..." + git fetch upstream + git push origin upstream/develop:develop + fi + if: env.GITHUB_REPOSITORY != 'smartcontractkit/chainlink'