reusable-create-operator-pull-request.yml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. name: Reusable - Create operator pull request
  2. on:
  3. workflow_call:
  4. inputs:
  5. version:
  6. type: string
  7. required: true
  8. secrets:
  9. BOT_TOKEN:
  10. required: true
  11. # to help with partial release build failures
  12. workflow_dispatch:
  13. inputs:
  14. version:
  15. description: "Version"
  16. required: true
  17. jobs:
  18. create-operator-pull-request:
  19. runs-on: ubuntu-latest
  20. steps:
  21. - uses: actions/checkout@v3
  22. with:
  23. repository: opentelemetrybot/opentelemetry-operator
  24. # this is the personal access token used for "git push" below
  25. token: ${{ secrets.BOT_TOKEN }}
  26. - name: Initialize pull request branch
  27. env:
  28. VERSION: ${{ inputs.version }}
  29. run: |
  30. git remote add upstream https://github.com/open-telemetry/opentelemetry-operator.git
  31. git fetch upstream
  32. git checkout -b update-opentelemetry-javaagent-to-${VERSION} upstream/main
  33. - name: Update version
  34. env:
  35. VERSION: ${{ inputs.version }}
  36. run: |
  37. echo $VERSION > autoinstrumentation/java/version.txt
  38. - name: Use CLA approved github bot
  39. run: |
  40. # cannot run the use-cla-approved-github-bot.sh script here since in a different repo
  41. git config user.name opentelemetrybot
  42. git config user.email 107717825+opentelemetrybot@users.noreply.github.com
  43. - name: Create pull request against opentelemetry-operator
  44. env:
  45. # this is the personal access token used for "gh pr create" below
  46. GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
  47. VERSION: ${{ inputs.version }}
  48. run: |
  49. message="Update the javaagent version to $VERSION"
  50. # note that @open-telemetry/java-instrumentation-approvers cannot be used below
  51. # because opentelemetrybot is not a member of the OpenTelemetry org,
  52. # and so it cannot @ mention OpenTelemetry org groups
  53. body="Update the javaagent version to \`$VERSION\`.
  54. cc @laurit @mateuszrzeszutek @trask
  55. "
  56. # gh pr create doesn't have a way to explicitly specify different head and base
  57. # repositories currently, but it will implicitly pick up the head from a different
  58. # repository if you set up a tracking branch
  59. git commit -a -m "$message"
  60. git push --set-upstream origin HEAD:update-opentelemetry-javaagent-to-${VERSION}
  61. gh pr create --title "$message" \
  62. --body "$body" \
  63. --repo open-telemetry/opentelemetry-operator \
  64. --base main