Skip to content

Commit 4f539e2

Browse files
committed
Change workflow trigger to release branch creation
1 parent a10eaad commit 4f539e2

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

.github/workflows/pin-system-tests.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ on:
44
workflow_dispatch:
55
inputs:
66
tag:
7-
description: 'The minor release tag (e.g. v1.54.0)'
7+
description: 'The minor release branch name (e.g. release/v1.54.x)'
88
required: true
99
type: string
10-
# for testing
11-
push:
12-
branches:
13-
- sarahchen6/pin-system-tests-workflow
10+
# run workflow when a release branch is created
11+
create:
1412

1513
jobs:
1614
pin-system-tests:
1715
name: "Pin system tests"
16+
if: github.event_name != 'create' || startsWith(github.ref, 'refs/heads/test/v')
1817
runs-on: ubuntu-latest
1918
permissions:
2019
contents: write # may not be needed
@@ -81,6 +80,16 @@ jobs:
8180
create-branch: true
8281
command: push
8382
commits: "${{ steps.create-commit.outputs.commit }}"
83+
84+
- name: Define base branch
85+
id: define-base-branch
86+
run: |
87+
if [[ -n "${{ github.event.inputs.tag }}" ]]; then
88+
BASE_BRANCH=${{ github.event.inputs.tag }}
89+
else
90+
BASE_BRANCH=${GITHUB_REF#refs/heads/}
91+
fi
92+
echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT
8493
8594
- name: Create pull request
8695
if: steps.check-changes.outputs.commit_changes == 'true' && steps.check-branch.outputs.creating_new_branch == 'true'
@@ -89,7 +98,7 @@ jobs:
8998
# base may need to be `release/v*`
9099
run: |
91100
gh pr create --title "Pin system tests for release branch" \
92-
--base release/v1.56.x \
101+
--base ${{ steps.define-base-branch.outputs.base_branch }} \
93102
--head ${{ steps.define-branch.outputs.branch }} \
94103
--label "tag: dependencies" \
95104
--label "tag: no release notes" \

0 commit comments

Comments
 (0)