Skip to content

Commit

Permalink
Create sync-fork.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscar-gg authored Sep 27, 2024
1 parent 2ec5a65 commit bd32bef
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/sync-fork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Sync Forked Repo

on:
workflow_run:
workflows: ["Node.js build"]
types:
- success # 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"}'

0 comments on commit bd32bef

Please sign in to comment.