Skip to content

Commit 387d37d

Browse files
authored
Refine pin-system-tests workflow (#10194)
* Refine pin-system-tests workflow * Remove extra lines
1 parent c2560c4 commit 387d37d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Pin system tests
33
on:
44
workflow_dispatch:
55
inputs:
6-
tag:
6+
release-branch-name:
77
description: 'The minor release branch name (e.g. release/v1.54.x)'
88
required: true
99
type: string
@@ -26,8 +26,20 @@ jobs:
2626
scope: DataDog/dd-trace-java
2727
policy: self.pin-system-tests.create-pr
2828

29+
- name: Define base branch
30+
id: define-base-branch
31+
run: |
32+
if [[ -n "${{ github.event.inputs.release-branch-name }}" ]]; then
33+
BASE_BRANCH=${{ github.event.inputs.release-branch-name }}
34+
else
35+
BASE_BRANCH=${GITHUB_REF#refs/heads/}
36+
fi
37+
echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT
38+
2939
- name: Checkout the repository
3040
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
41+
with:
42+
ref: ${{ steps.define-base-branch.outputs.base_branch }}
3143

3244
- name: Define branch name
3345
id: define-branch
@@ -40,7 +52,6 @@ jobs:
4052
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
4153
echo "creating_new_branch=false" >> "$GITHUB_OUTPUT"
4254
echo "Branch $BRANCH already exists - please delete it and re-run the workflow."
43-
exit 0
4455
else
4556
echo "creating_new_branch=true" >> "$GITHUB_OUTPUT"
4657
echo "Branch $BRANCH does not exist - creating it now"
@@ -55,7 +66,6 @@ jobs:
5566
if [[ -z "$(git status -s)" ]]; then
5667
echo "No changes to commit, exiting."
5768
echo "commit_changes=false" >> "$GITHUB_OUTPUT"
58-
exit 0
5969
else
6070
echo "commit_changes=true" >> "$GITHUB_OUTPUT"
6171
echo "Changes to commit:"
@@ -81,16 +91,6 @@ jobs:
8191
create-branch: true
8292
command: push
8393
commits: "${{ steps.create-commit.outputs.commit }}"
84-
85-
- name: Define base branch
86-
id: define-base-branch
87-
run: |
88-
if [[ -n "${{ github.event.inputs.tag }}" ]]; then
89-
BASE_BRANCH=${{ github.event.inputs.tag }}
90-
else
91-
BASE_BRANCH=${GITHUB_REF#refs/heads/}
92-
fi
93-
echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT
9494

9595
- name: Create pull request
9696
if: steps.check-changes.outputs.commit_changes == 'true' && steps.check-branch.outputs.creating_new_branch == 'true'

0 commit comments

Comments
 (0)