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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. body="Update the javaagent version to \`$VERSION\`."
  51. # gh pr create doesn't have a way to explicitly specify different head and base
  52. # repositories currently, but it will implicitly pick up the head from a different
  53. # repository if you set up a tracking branch
  54. git commit -a -m "$message"
  55. git push --set-upstream origin HEAD:update-opentelemetry-javaagent-to-${VERSION}
  56. gh pr create --title "$message" \
  57. --body "$body" \
  58. --reviewer open-telemetry/java-instrumentation-approvers \
  59. --repo open-telemetry/opentelemetry-operator \
  60. --base main