reusable-create-java-docs-pull-request.yml 2.5 KB

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