Skip to content

Commit ec97a43

Browse files
authored
Automate backports (#5686)
* Automate backports * Update releasing doc * updates
1 parent 6eb15db commit ec97a43

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Backport a pull request
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
pr:
6+
description: "The pull request # to backport"
7+
required: true
8+
9+
jobs:
10+
backport:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
# need full tree in order to do cherry-pick
16+
fetch-depth: 0
17+
18+
- name: Setup git name
19+
run: |
20+
git config user.name opentelemetry-java-bot
21+
git config user.email [email protected]
22+
23+
- name: Create pull request
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
PR: ${{ github.event.inputs.pr }}
27+
run: |
28+
commit=$(gh pr view $PR --json mergeCommit --jq .mergeCommit.oid)
29+
title=$(gh pr view $PR --json title --jq .title)
30+
url=$(gh pr view $PR --json url --jq .url)
31+
32+
git cherry-pick $commit
33+
git push origin HEAD:backport-$PR-to-$GITHUB_REF_NAME
34+
35+
gh pr create --title "[$GITHUB_REF_NAME] $title" \
36+
--body "Clean cherry-pick of #$PR to the $GITHUB_REF_NAME branch." \
37+
--head backport-$PR-to-$GITHUB_REF_NAME \
38+
--base $GITHUB_REF_NAME

RELEASING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ In general, patch releases are only made for bug-fixes for the following types o
4040

4141
Before making the release:
4242

43-
* Merge PR(s) containing the desired patches to the release branch
43+
* Backport PR(s) to the release branch
44+
* Run the [Backport workflow](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/prepare-patch-release.yml).
45+
* Press the "Run workflow" button, then select the release branch from the dropdown list,
46+
e.g. `v1.9.x`, then enter the PR number that you wan to backport,
47+
then click the "Run workflow" button below that.
48+
* Review and merge the backport PR that it generates
4449
* Merge a PR to the release branch updating the `CHANGELOG.md`
4550
* Run the [Prepare Patch Release workflow](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/prepare-patch-release.yml).
4651
* Press the "Run workflow" button, then select the release branch from the dropdown list,

0 commit comments

Comments
 (0)