Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: auto syncing between public and private master #615

Merged
merged 10 commits into from
Apr 15, 2020

Conversation

boolafish
Copy link
Contributor

@boolafish boolafish commented Apr 10, 2020

Note

Setup a auto sync Github action workflow to:

  1. Whenever a new code pushed to master in public repo, it would dispatch an event to the private repo. (with event_type: sync-from-public)
  2. Once received the dispatched event, the private repo would sync the master of the private with the public repo.
  3. After the master branch is synced, it would automatically submit a PR to sync master back to the base branch of the private repo (master-private)
  4. Created a new personal token of the lovely omisego-bot for this use. Set HOUSE_KEEPER_BOT_TOKEN as Github secret of the repo (both public & private)

Note that the dispatch event requires the workflow file to be in the base branch (usually master) to be able to work. see: https://github.community/t5/GitHub-Actions/repository-dispatch-not-triggering-actions/td-p/33817

Also, this means this would only take effect after this PR is merged and sync the change to the base branch of plasma-contracts-private.

Test

This setup requires it to be in master (or the base branch) of the repo, as a result, I was using my own public fork and messing around the plasma-contracts-private repo to test.

It was tested by replacing some of the repo with boolafish/plasma-contracts instead of omisego/plasma-contracts

@boolafish boolafish force-pushed the boolafish/auto_sync_with_gh_action branch from 7f34b3d to 79cf514 Compare April 10, 2020 10:40
@boolafish boolafish requested a review from a team April 10, 2020 10:41
@boolafish boolafish force-pushed the boolafish/auto_sync_with_gh_action branch from 79cf514 to 7159dc1 Compare April 10, 2020 10:47
Copy link
Contributor

@InoMurko InoMurko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice! This opens a PR on the private repo?

@boolafish
Copy link
Contributor Author

This opens a PR on the private repo?

yes. Once master in public is pushed, the master in private would also be synced (and thus pushed).
After master in private is pushed, it will automatically create a PR to ask to merge to master-private

- uses: actions/checkout@v2
- name: Repository Dispatch
if: github.repository == 'omisego/plasma-contracts'
uses: peter-evans/repository-dispatch@v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who is peter evans? Sorry. I haven’t used gh actions before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know either. I just randomly picked from the Github action market place
https://github.com/marketplace/actions/repository-dispatch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, since it is fairly simple, I tried to remove those marketplace dependencies with shell scripts instead.

@boolafish boolafish force-pushed the boolafish/auto_sync_with_gh_action branch 2 times, most recently from 108e98d to 37a223e Compare April 13, 2020 09:29
@boolafish boolafish force-pushed the boolafish/auto_sync_with_gh_action branch from 37a223e to e6b208d Compare April 13, 2020 10:09
@boolafish boolafish force-pushed the boolafish/auto_sync_with_gh_action branch from e6b208d to 2fa36b1 Compare April 13, 2020 10:13
@boolafish boolafish requested review from a team and removed request for a team April 13, 2020 10:14
@boolafish boolafish requested review from pgebal and pik694 April 14, 2020 08:27
@boolafish boolafish merged commit 3c5487c into master Apr 15, 2020
@boolafish boolafish deleted the boolafish/auto_sync_with_gh_action branch April 15, 2020 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants