forked from RoBorregos/test-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
29 lines (26 loc) · 939 Bytes
/
sync-fork.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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"}'