merge-change-log-to-main.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. name: Merge change log to main
  2. on:
  3. workflow_dispatch:
  4. jobs:
  5. create-pull-request:
  6. runs-on: ubuntu-20.04
  7. steps:
  8. - uses: actions/checkout@v3
  9. with:
  10. # this workflow is run against the release branch (see usage of GITHUB_REF_NAME below)
  11. # but it is creating a pull request against main
  12. ref: main
  13. # history is needed to run format-patch below
  14. fetch-depth: 0
  15. - name: Set git user
  16. run: |
  17. git config user.name opentelemetry-java-bot
  18. git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
  19. # this will fail if there have been conflicting change log updates introduced in main
  20. - name: Create pull request against main
  21. env:
  22. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  23. run: |
  24. git format-patch --stdout HEAD..origin/$GITHUB_REF_NAME CHANGELOG.md | git apply
  25. msg="Merge change log updates from $GITHUB_REF_NAME to main"
  26. git commit -a -m "$msg"
  27. git push origin HEAD:merge-change-log-updates-to-main
  28. gh pr create --title "$msg" \
  29. --body "$msg" \
  30. --head merge-change-log-updates-to-main \
  31. --base main