reusable-create-java-contrib-pull-request.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. name: Reusable - Create Java contrib 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-java-contrib-pull-request:
  19. runs-on: ubuntu-latest
  20. steps:
  21. - uses: actions/checkout@v3
  22. with:
  23. repository: opentelemetrybot/opentelemetry-java-contrib
  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-java-contrib.git
  31. git fetch upstream
  32. git checkout -b update-opentelemetry-sdk-to-${VERSION} upstream/main
  33. - name: Update version
  34. env:
  35. VERSION: ${{ inputs.version }}
  36. run: ./.github/scripts/update-sdk-version.sh $VERSION
  37. - name: Use CLA approved github bot
  38. run: .github/scripts/use-cla-approved-github-bot.sh
  39. - name: Create pull request against opentelemetry-java-contrib
  40. env:
  41. # this is the personal access token used for "gh pr create" below
  42. GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
  43. VERSION: ${{ inputs.version }}
  44. run: |
  45. message="Update the SDK and instrumentation versions to $VERSION"
  46. body=$(cat << EOF
  47. Update the SDK and instrumentation versions to \`$VERSION\`.
  48. Note: you will likely need to re-run the checks on this PR in an hour or so, once the
  49. updated dependencies are visible in maven central.
  50. EOF
  51. )
  52. # gh pr create doesn't have a way to explicitly specify different head and base
  53. # repositories currently, but it will implicitly pick up the head from a different
  54. # repository if you set up a tracking branch
  55. git commit -a -m "$message"
  56. git push --set-upstream origin HEAD:update-opentelemetry-sdk-to-${VERSION}
  57. gh pr create --title "$message" \
  58. --body "$body" \
  59. --repo open-telemetry/opentelemetry-java-contrib \
  60. --base main