Synchronize GitHub Directly With GOSH
TL;DR
GOSH GitHub Sync is an easy way to enable GOSH DAOs to work side by side with GitHub Repositories
Build Consensus around your code and organization through DAOs on GOSH while continuing to use GitHub’s familiar development tools
Using GOSH GitHub Sync is easy, with a step-by-step guide to setting it up included below
Introduction
A year ago we introduced the Login with GitHub option to easily migrate your repositories to GOSH when you sign up. Now we are enhancing this capability enabling continuous synchronization of your GitHub and GOSH repositories.
Synchronize your GitHub repositories with GOSH, and work with both platforms side by side. Changes in a GitHub repository appear in GOSH, offering both the benefits from GitHub features, convenience, and efficiency; while not compromising the decentralization of code and governance, as assured by GOSH.
Here’s How It Works
github-actions are triggered by changes in the github repository and execute their script. User’s changes will be pushed automatically to GOSH. The script will clone the repository, and its history, and push these branch changes to the matching branch in GOSH.
How To Set It Up
Step 1, Prerequisites
Create a separate bot account in GitHub, and register this bot on GOSH
Add this bot to the DAO with the repository you want to synchronize
GitHub Sync requires CONFIG_JSON and GOSH_URL set up
You need only a single bot for the whole DAO
Step 2, For CONFIG_JSON set up to copy bot credentials
You need to copy config.json content under ‘Show’
Go to repository settings > Secrets and variables in GitHub, and press ‘New repository secret,’ and add credentials
Hint: you can use CONFIG_JSON once for your whole organization
Step 3, GOSH_URL
GOSH_URL is a variable in github-actions. It must point to the GOSH repository (the one we sync changes to)
By clicking on ‘New repository variable:’
Step 4, copy/paste
Enable github-actions by creating a /.github/workflows folder in your GitHub repository. You can also create it in your user interface and copy the content below, and GitHub will create the folder for you automatically. Create a gosh-sync.yaml file inside, in this aforementioned folder and add this content:
name: Sync with Gosh
on:
workflow_dispatch:
push:
branches:
- main
jobs:
sync:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
# Only a single commit is fetched by default, for the ref/SHA that
# triggered the workflow. Set fetch-depth: 0 to fetch all history for
# all branches and tags.
fetch-depth: 0
- name: Sync
env:
CONFIG_JSON: ${{ secrets.CONFIG_JSON }}
GOSH_URL: ${{ vars.GOSH_URL }}
GOSH_TMP_BRANCH: github_${{ github.ref_name }}
run: |
# install GOSH Git Remote plugin
wget -O - https://raw.githubusercontent.com/gosh-sh/gosh/dev/install.sh | bash -s
export PATH="$HOME"/.gosh:"$PATH"
# set user secrets
echo "$CONFIG_JSON" >~/.gosh/config.json
# sync github -> gosh
git remote add gosh $GOSH_URL
git switch -C $GOSH_TMP_BRANCH
git push -vv gosh
After this is done, all of the changes pushed to GitHub will be seen on gosh (except the branches’ names). Starting from this first commit onwards, every change to your GitHub repository will be mirrored to GOSH. For example, if there were changes in a main branch in GitHub, these changes will appear in github_main branch in GOSH and once DAO decides to accept those changes they can create a proposal to merge changes from github_main branch into main, inside GOSH.
For more news about GOSH: