Skip to content

Sync Forked Repo

Sync Forked Repo #16

Workflow file for this run

name: Sync Forked Repo
on:
workflow_run:
workflows: ["Node.js build"]
types:
- completed # Options: completed, success, failure
env: # Define environment variables at the workflow level
PERSONAL_ACCOUNT: roborregosteam
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Update Fork
# Avoid re-running job on account that hosts repositories
if: ${{ github.repository_owner != env.PERSONAL_ACCOUNT}}
run: |
# Assume repo has the same name in account
REPO_NAME=${GITHUB_REPOSITORY##*/}
ACCOUNT=${{env.PERSONAL_ACCOUNT}}
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.RBRGS_TEAM_GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$ACCOUNT/$REPO_NAME/merge-upstream \
-d '{"branch": "main"}'