Skip to content

Commit fe2beeb

Browse files
committed
Refine pin-system-tests workflow
1 parent c2560c4 commit fe2beeb

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

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

Lines changed: 15 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,7 @@ 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
55+
exit 0 # REMOVE THIS
4456
else
4557
echo "creating_new_branch=true" >> "$GITHUB_OUTPUT"
4658
echo "Branch $BRANCH does not exist - creating it now"
@@ -55,7 +67,7 @@ jobs:
5567
if [[ -z "$(git status -s)" ]]; then
5668
echo "No changes to commit, exiting."
5769
echo "commit_changes=false" >> "$GITHUB_OUTPUT"
58-
exit 0
70+
exit 0 # REMOVE THIS
5971
else
6072
echo "commit_changes=true" >> "$GITHUB_OUTPUT"
6173
echo "Changes to commit:"
@@ -81,16 +93,6 @@ jobs:
8193
create-branch: true
8294
command: push
8395
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
9496

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

0 commit comments

Comments
 (0)