name: Sync to enterprise on: schedule: - cron: '0 */6 * * *' push: branches: - main-v* jobs: sync_to_enterprise: runs-on: ubuntu-20.04 if: github.repository == 'emqx/emqx' steps: - name: git-sync uses: Rory-Z/git-sync@v3.0.1 with: source_repo: ${{ github.repository }} source_branch: ${{ github.ref }} destination_repo: "${{ github.repository_owner }}/emqx-enterprise" destination_branch: ${{ github.ref }} destination_ssh_private_key: "${{ secrets.CI_SSH_PRIVATE_KEY }}" - name: create pull request id: create_pull_request run: | set -euo pipefail EE_REF="${GITHUB_REF}-enterprise" 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 from opensource $GITHUB_REF to entperprise $EE_REF\", \"head\": \"$GITHUB_REF\", \"base\":\"$EE_REF\"}" \ 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: | set -euo pipefail curl --silent --show-error \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \ -X POST \ -d '{"team_reviewers":["emqx-devs"]}' \ ${{ steps.create_pull_request.outputs.url }}/requested_reviewers