From bd32bef2aeb9b8df51c60f5300fb4be524f200ae Mon Sep 17 00:00:00 2001 From: Oscar Arreola <77394565+Oscar-gg@users.noreply.github.com> Date: Fri, 27 Sep 2024 01:42:17 -0600 Subject: [PATCH] Create sync-fork.yml --- .github/workflows/sync-fork.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/sync-fork.yml diff --git a/.github/workflows/sync-fork.yml b/.github/workflows/sync-fork.yml new file mode 100644 index 0000000..f766f72 --- /dev/null +++ b/.github/workflows/sync-fork.yml @@ -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"}'