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:
Navigate to your GitHub repository and go to the "Settings" tab.
Under "Secrets and variables," select "Actions" then click "New Repository Secret."
Add a new secret with "Name" as “WALLET”, paste your Arweave wallet's JWK into the "Secret" field, and click "Add secret."
Go to the "Actions" tab of your repository.
Click "New workflow" if you have existing actions, or follow the prompt to "Get started with GitHub Actions" if it's your first time.
Choose to "Set up a workflow yourself."
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
The code is set to automatically execute with every push to the
main
branch. For manual execution, modify theon:
section to includeworkflow_dispatch:
.If desired, you can adjust the workflow to only sync the main branch by commenting out the 'Checkout all branches' section.
Navigate to your organization page on Protocol.Land.
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:
[](https://protocol.land/#/repository/<REPO_ID>)
Using the above line in your README file will show Published on Protocol.Land
badge like this one .
Last updated