Import a repository from GitHub

Backup a GitHub repository directly to an organization on Protocol.Land.

Backing up your repository to an organization you own on Protocol.Land helps you group your repositories you import from Github with managed access control.

Follow these steps to backup your GitHub repository to an organization on Protocol.Land:

  1. Navigate to your GitHub repository and go to the "Settings" tab.

  2. Under "Secrets and variables," select "Actions" then click "New Repository Secret."

  3. Add a new secret with "Name" as “WALLET”, paste your Arweave wallet's JWK into the "Secret" field, and click "Add secret."

  4. Go to the "Actions" tab of your repository.

  5. Click "New workflow" if you have existing actions, or follow the prompt to "Get started with GitHub Actions" if it's your first time.

  6. Choose to "Set up a workflow yourself."

  7. In the .yml file that appears, copy and paste the provided YAML code and commit the changes. This code includes crucial steps, such as checking out all branches and setting up node environments before syncing to Protocol Land.

name: Protocol Land Sync
on:
    # Run with every push to 'main' branch:
    push:
        branches:
            - 'main'
    # Run Manually:
    #workflow_dispatch:
jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            - name: 'Checkout repo (default branch)'
              uses: actions/checkout@v3
              with:
                  # fetch all history for all branches:
                  fetch-depth: 0
            - name: 'Checkout all branches'
              run: |
                  default_branch=$(git branch | grep '*' | sed 's/\* //')
                  for abranch in $(git branch -a | grep -v HEAD | grep remotes | sed "s/remotes\/origin\///g"); do git checkout $abranch ; done
                  git checkout $default_branch
                  git branch -a
            - name: 'Setup node 18'
              uses: actions/setup-node@v3
              with:
                  node-version: 18.x
            - name: 'Sync repo to Protocol Land'
              run: npx @protocol.land/sync
              env:
                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
                  REPO_TITLE: ${{ github.event.repository.name }}
                  REPO_DESCRIPTION: ${{ github.event.repository.description }}
                  WALLET: ${{ secrets.WALLET }}
                  ORGANIZATION_NAME: protocol-land ## <- Edit this to Name of your organization
  1. The code is set to automatically execute with every push to the main branch. For manual execution, modify the on: section to include workflow_dispatch:.

  2. If desired, you can adjust the workflow to only sync the main branch by commenting out the 'Checkout all branches' section.

  3. Navigate to your organization page on Protocol.Land.

  4. Under "Repositories" tab you should now see the imported repo.

Add published badge to your Github repo

When you sync your GitHub repo with Protocol.Land, proudly display the "Published on Protocol.land" badge in your README. Use the below template and replace <REPO_ID> with your Protocol.Land repo ID:

[![protocol.land](https://arweave.net/eZp8gOeR8Yl_cyH9jJToaCrt2He1PHr0pR4o-mHbEcY)](https://protocol.land/#/repository/<REPO_ID>)

Last updated