reusable-create-website-pull-request.yml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. name: Reusable - Create website 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-website-pull-request:
  19. runs-on: ubuntu-latest
  20. steps:
  21. - name: Sync opentelemetry.io fork
  22. env:
  23. # this is the personal access token used for "gh repo sync" below
  24. GH_TOKEN: ${{ secrets.BOT_TOKEN }}
  25. run: |
  26. # synchronizing the fork is fast, and avoids the need to fetch the full upstream repo
  27. # (fetching the upstream repo with "--depth 1" would lead to "shallow update not allowed"
  28. # error when pushing back to the origin repo)
  29. gh repo sync opentelemetrybot/opentelemetry.io \
  30. --source open-telemetry/opentelemetry.io \
  31. --force
  32. - uses: actions/checkout@v3
  33. with:
  34. repository: opentelemetrybot/opentelemetry.io
  35. # this is the personal access token used for "git push" below
  36. token: ${{ secrets.BOT_TOKEN }}
  37. - name: Update version
  38. env:
  39. VERSION: ${{ inputs.version }}
  40. run: |
  41. # TODO (trask) this will need to be updated when instrumentation-annotations are stable
  42. sed -Ei "s/^javaAnnotationsVersion: [0-9.]+-alpha$/javaAnnotationsVersion: ${VERSION}-alpha/" content/en/docs/instrumentation/java/automatic/annotations.md
  43. - name: Use CLA approved github bot
  44. run: |
  45. # cannot run the use-cla-approved-github-bot.sh script here since in a different repo
  46. git config user.name opentelemetrybot
  47. git config user.email 107717825+opentelemetrybot@users.noreply.github.com
  48. - name: Create pull request against opentelemetry.io
  49. env:
  50. VERSION: ${{ inputs.version }}
  51. # this is the personal access token used for "gh pr create" below
  52. GH_TOKEN: ${{ secrets.BOT_TOKEN }}
  53. run: |
  54. message="Update the Java instrumentation versions to $VERSION"
  55. body="Update the Java instrumentation version to \`$VERSION\`."
  56. branch="update-opentelemetry-java-instrumentation-to-${VERSION}"
  57. # gh pr create doesn't have a way to explicitly specify different head and base
  58. # repositories currently, but it will implicitly pick up the head from a different
  59. # repository if you set up a tracking branch
  60. git checkout -b $branch
  61. git commit -a -m "$message"
  62. git push --set-upstream origin $branch
  63. gh pr create --title "$message" \
  64. --body "$body" \
  65. --repo open-telemetry/opentelemetry.io \
  66. --base main