git_sync.yaml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. name: Sync to enterprise
  2. on:
  3. push:
  4. branches:
  5. - master
  6. jobs:
  7. sync_to_enterprise:
  8. runs-on: ubuntu-20.04
  9. if: github.repository == 'emqx/emqx'
  10. steps:
  11. - name: git-sync
  12. uses: Rory-Z/git-sync@v3.0.1
  13. with:
  14. source_repo: ${{ github.repository }}
  15. source_branch: ${{ github.ref }}
  16. destination_repo: "${{ github.repository_owner }}/emqx-enterprise"
  17. destination_branch: ${{ github.ref }}
  18. destination_ssh_private_key: "${{ secrets.CI_SSH_PRIVATE_KEY }}"
  19. - name: create pull request
  20. id: create_pull_request
  21. run: |
  22. set -euo pipefail
  23. R=$(curl --silent --show-error \
  24. -H "Accept: application/vnd.github.v3+json" \
  25. -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
  26. -X POST \
  27. -d '{"title": "Sync code into enterprise from opensource", "head": "master", "base":"enterprise"}' \
  28. https://api.github.com/repos/${{ github.repository_owner }}/emqx-enterprise/pulls)
  29. echo $R | jq
  30. echo "::set-output name=url::$(echo $R | jq '.url')"
  31. - name: request reviewers for a pull request
  32. if: steps.create_pull_request.outputs.url != 'null'
  33. run: |
  34. set -euo pipefail
  35. curl --silent --show-error \
  36. -H "Accept: application/vnd.github.v3+json" \
  37. -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
  38. -X POST \
  39. -d '{"team_reviewers":["emqx-devs"]}' \
  40. ${{ steps.create_pull_request.outputs.url }}/requested_reviewers