Sync Forked Repo #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"}' |