-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Github action to sync develop branch from smartcontractkit/chainlink …
…every 30 minutes
- Loading branch information
1 parent
0cfad53
commit 0d33508
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
.github/workflows/sync-develop-from-smartcontractkit-chainlink.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |