chore(CI): add reviewers for sync code PR

This commit is contained in:
zhanghongtong 2021-04-07 16:29:38 +08:00 committed by Rory Z
parent 0b904bb28b
commit b9a4eceda1
1 changed files with 16 additions and 3 deletions

View File

@ -8,7 +8,7 @@ on:
jobs: jobs:
sync_to_enterprise: sync_to_enterprise:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
if: github.repository == 'emqx/emqx' if: github.repository == '${{ github.repository_owner }}/emqx'
steps: steps:
- name: git-sync - name: git-sync
uses: Rory-Z/git-sync@v3.0.1 uses: Rory-Z/git-sync@v3.0.1
@ -19,11 +19,24 @@ jobs:
destination_branch: ${{ github.ref }} destination_branch: ${{ github.ref }}
destination_ssh_private_key: "${{ secrets.CI_SSH_PRIVATE_KEY }}" destination_ssh_private_key: "${{ secrets.CI_SSH_PRIVATE_KEY }}"
- name: create pull request - name: create pull request
id: create_pull_request
run: |
set -euo pipefail
R=$(curl --silent --show-error \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
-X POST \
-d '{"title": "Sync code into enterprise from opensource", "head": "master", "base":"enterprise"}' \
https://api.github.com/repos/${{ github.repository_owner }}/emqx-enterprise/pulls)
echo $R | jq
echo "::set-output name=url::$(echo $R | jq '.url')"
- name: request reviewers for a pull request
if: steps.create_pull_request.outputs.url != 'null'
run: | run: |
set -euo pipefail set -euo pipefail
curl --silent --show-error \ curl --silent --show-error \
-H "Accept: application/vnd.github.v3+json" \ -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \ -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
-X POST \ -X POST \
-d '{"title": "Sync code into enterprise from opensource", "head": "master", "base":"enterprise"}' \ -d '{"team_reviewers":["emqx-devs"]}' \
https://api.github.com/repos/${{ github.repository_owner }}/emqx-enterprise/pulls ${{ steps.create_pull_request.outputs.url }}/requested_reviewers