Skip to content

Commit 612ea9f

Browse files
authored
Add workflows for automatic PRs on release-fix and release-integration branches, Fixes AB#3370366 (#2833)
This pull request introduces two new GitHub Actions workflows to automate the process of opening pull requests when specific release-related branches are created. These workflows help streamline the integration of release fixes and release integration branches by automatically creating pull requests targeting the appropriate base branches. **Automated Pull Request Workflows:** * Added `.github/workflows/integration/release-fix.yml` to automatically open a pull request from any newly created `release-fix/*` branch to the corresponding `release/<version>` branch. This includes logic to extract the version from the branch name and set the PR title and body accordingly. * Added `.github/workflows/integration/release-integration.yml` to automatically open a pull request from any newly created `release-integration/*` branch to the `dev` branch, with a standardized PR title and body. [AB#3370366](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3370366)
1 parent c11652a commit 612ea9f

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
##
2+
# Workflow: release-fix auto PR
3+
# Purpose: When a `release-fix/*` branch is created, automatically
4+
# open a pull request targeting the corresponding `release/<version>` branch.
5+
# Maintainer: Android Team - Release Engineering
6+
# Docs: See repository CONTRIBUTING.md for release process guidance
7+
##
8+
name: Auto PR to merge release-fix branches into release
9+
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
14+
on:
15+
create:
16+
17+
jobs:
18+
create-pr:
19+
if: >
20+
github.event.ref_type == 'branch' &&
21+
startsWith(github.event.ref, 'release-fix/') &&
22+
vars.ENABLE_RELEASE_AUTOMATION == 'true'
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Compute target release version
30+
id: compute_version
31+
run: |
32+
BRANCH_NAME="${{ github.event.ref }}"
33+
if [[ "$BRANCH_NAME" =~ ^release-fix/(.+)$ ]]; then
34+
VERSION="${BASH_REMATCH[1]}"
35+
echo "version=$VERSION" >> $GITHUB_OUTPUT
36+
echo "Computed version: $VERSION"
37+
else
38+
echo "Failed to compute version from branch: $BRANCH_NAME"
39+
exit 1
40+
fi
41+
42+
- name: Create Pull Request
43+
env:
44+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
run: |
46+
gh pr create \
47+
--base "release/${{ steps.compute_version.outputs.version }}" \
48+
--head "${{ github.event.ref }}" \
49+
--title "Auto PR: ${{ github.event.ref }} → release/${{ steps.compute_version.outputs.version }}" \
50+
--body "This is an automated pull request created to integrate release changes into release/${{ steps.compute_version.outputs.version }}. Triggered when the branch ${{ github.event.ref }} was published."
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
##
2+
# Workflow: release-integration auto PR
3+
# Purpose: When a `release-integration/*` branch is created, automatically
4+
# open a pull request targeting `dev` to integrate release changes.
5+
##
6+
name: Auto PR to dev for release-integration branches
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
on:
13+
create:
14+
15+
concurrency:
16+
group: auto-pr-release-integration-${{ github.event.ref }}
17+
cancel-in-progress: false
18+
19+
jobs:
20+
create-pr:
21+
if: >
22+
github.event.ref_type == 'branch' &&
23+
startsWith(github.event.ref, 'release-integration/') &&
24+
vars.ENABLE_RELEASE_AUTOMATION == 'true'
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
- name: Create Pull Request
31+
env:
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: |
34+
gh pr create \
35+
--base dev \
36+
--head "${{ github.event.ref }}" \
37+
--title "Auto PR: ${{ github.event.ref }} → dev" \
38+
--body "This is an automated pull request created to integrate release changes into **dev**. Triggered when the branch **${{ github.event.ref }}** was published."

0 commit comments

Comments
 (0)