Create website PR on release (#6650)

This commit is contained in:
Trask Stalnaker 2022-09-19 08:39:27 -07:00 committed by GitHub
parent fc0d94ce4a
commit 08ba0a9ddd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 0 deletions

View File

@ -277,3 +277,11 @@ jobs:
version: ${{ needs.release.outputs.version }}
secrets:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
create-website-pull-request:
needs: release
uses: ./.github/workflows/reusable-create-website-pull-request.yml
with:
version: ${{ needs.release.outputs.version }}
secrets:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}

View File

@ -0,0 +1,66 @@
name: Reusable - Create website pull request
on:
workflow_call:
inputs:
version:
type: string
required: true
secrets:
BOT_TOKEN:
required: true
# to help with partial release build failures
workflow_dispatch:
inputs:
version:
description: "Version"
required: true
jobs:
create-java-website-pull-request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: opentelemetrybot/opentelemetry.io
# this is the personal access token used for "git push" below
token: ${{ secrets.BOT_TOKEN }}
- name: Initialize pull request branch
env:
VERSION: ${{ inputs.version }}
run: |
git remote add upstream https://github.com/open-telemetry/opentelemetry.io.git
git fetch upstream
git checkout -b update-opentelemetry-java-instrumentation-to-${VERSION} upstream/main
git submodule update
- name: Update version
env:
VERSION: ${{ inputs.version }}
run: |
# TODO (trask) this will need to be updated when instrumentation-annotations are stable
sed -Ei "s/^javaAnnotationsVersion: [0-9.]+$/javaAnnotationsVersion: ${VERSION}-alpha/" content/en/docs/instrumentation/java/automatic/annotations.md
- name: Use CLA approved github bot
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Create pull request against opentelemetry.io
env:
# this is the personal access token used for "gh pr create" below
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
VERSION: ${{ inputs.version }}
run: |
message="Update the Java instrumentation versions to $VERSION"
body="Update the Java instrumentation version to \`$VERSION\`."
# gh pr create doesn't have a way to explicitly specify different head and base
# repositories currently, but it will implicitly pick up the head from a different
# repository if you set up a tracking branch
git commit -a -m "$message"
git push --set-upstream origin HEAD:update-opentelemetry-java-instrumentation-to-${VERSION}
gh pr create --title "$message" \
--body "$body" \
--repo open-telemetry/opentelemetry.io \
--base main