-
-
Notifications
You must be signed in to change notification settings - Fork 438
39 lines (33 loc) · 1.54 KB
/
sync-pull-request.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
30
31
32
33
34
35
36
37
38
39
name: Sync pull request from private repository
on:
workflow_dispatch:
jobs:
repo-sync:
if: "github.repository == 'arduino/docs-content-private'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DOCS_PRIVATE_SSH_KEY }}
known_hosts: unnecessary
- name: Sync branch
run: |
git remote add mirror [email protected]:arduino/docs-content.git
git config --global user.email "sync@docs-content-private"
git config --global user.name "docs-sync"
git checkout -b sync/${GITHUB_REF_NAME}
git push -u mirror sync/${GITHUB_REF_NAME}
- name: Sync PR
env:
GITHUB_TOKEN: ${{ secrets.SYNC_GITHUB_CLI_TOKEN }}
run: gh pr create --repo arduino/docs-content --head sync/${GITHUB_REF_NAME} --title "$(gh pr view $GITHUB_REF_NAME --json title --jq .title)" --body "$(gh pr view $GITHUB_REF_NAME --json body --jq .body)" --label "$(gh pr view $GITHUB_REF_NAME --json labels --jq .labels[].name)" --reviewer "$(gh pr view $GITHUB_REF_NAME --json reviewRequests --jq .reviewRequests[].login)" --label "arduino" --assignee "$(gh pr view $GITHUB_REF_NAME --json assignees --jq .assignees[].login)"
- name: Close PR
env:
GITHUB_TOKEN: ${{ secrets.SYNC_GITHUB_CLI_TOKEN }}
run: gh pr close $GITHUB_REF_NAME
- name: Delete branch
run: git push origin :${GITHUB_REF_NAME}