Skip to content

Instantly share code, notes, and snippets.

@seripap
Last active August 9, 2023 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seripap/f1623829e41809dc43f4792fb44ad490 to your computer and use it in GitHub Desktop.
Save seripap/f1623829e41809dc43f4792fb44ad490 to your computer and use it in GitHub Desktop.
Sync GitHub and Pierre.co

Sync GitHub Pull Requests to Pierre.co

Add secrets, PIERRE_RSA_KEY and PIERRE_RSA_KNOWN_HOSTS to your GitHub Actions secrets. Move these workflow files into .github/workflows to use them. This currently only syncs 1 user, could be updated to support multiple users. This is meant to help test Pierre as these scripts will continue to force push to Pierre.

PIERRE_RSA_KEY is your Pierre private key, PIERRE_RSA_KNOWN_HOSTS can be pulled using the following command: ssh-keyscan git.pierre.co, which looks something like

git.pierre.co ssh-rsa AAAA...

pr-pierre.yaml

Sends all pull requests to Pierre on open, reopen, and pushes.

pr-pierre-closed.yaml

When a PR is closed, the branch will be deleted from Pierre.

pierre-main.yaml

When a merge or push to main happens, that push will be replicated in Pierre. Change instances of main to any other branch name.

name: 'Keep main up to date in Pierre'
on:
push:
branches:
- main
jobs:
pierre:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: Install SSH
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.PIERRE_RSA_KEY }}
known_hosts: ${{ secrets.PIERRE_RSA_KNOWN_HOSTS }}
- name: Push To Pierre
run: |
echo "Pushing to Pierre"
git config user.name "Your Name"
git config user.email "Your Pierre Email"
git remote add pierre git@git.pierre.co:/repos/{your-pierre-team-name}/{your-repo-name}.git
git push -u pierre main --force
name: 'Delete from Pierre'
on:
pull_request:
types: [closed]
concurrency:
group: pierre-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
pierre:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install SSH
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.PIERRE_RSA_KEY }}
known_hosts: ${{ secrets.PIERRE_RSA_KNOWN_HOSTS }}
- name: Push To Pierre
run: |
echo "Pushing to Pierre"
git config user.name "Your Name"
git config user.email "Your Pierre Email"
git remote add pierre git@git.pierre.co:/repos/{your-pierre-team-name}/{your-repo-name}.git
git push -u pierre --delete ${{ github.head_ref || github.ref_name }} --force
name: 'Synchronize to Pierre'
on:
pull_request:
types: [opened, reopened, synchronize]
concurrency:
group: pierre-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
pierre:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install SSH
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.PIERRE_RSA_KEY }}
known_hosts: ${{ secrets.PIERRE_RSA_KNOWN_HOSTS }}
- name: Push To Pierre
run: |
echo "Pushing to Pierre"
git config user.name "Your Name"
git config user.email "Your Pierre Email"
git remote add pierre git@git.pierre.co:/repos/{your-pierre-team-name}/{your-repo-name}.git
git checkout -b ${{ github.head_ref || github.ref_name }}
git push -u pierre ${{ github.head_ref || github.ref_name }} --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment