Skip to content

Commit 730db20

Browse files
support PR in sign-for-dev-release.yml
1 parent 9673821 commit 730db20

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

.azure-pipelines/sign-for-dev-release.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,29 @@ extends:
8080
inputs:
8181
targetType: inline
8282
script: |-
83-
TARGET_BRANCH=$(TOOLKIT_BRANCH)
83+
CUSTOM_BRANCH=$(TOOLKIT_BRANCH)
84+
SOURCE_BRANCH=$(System.PullRequest.SourceBranch 2>/dev/null)
85+
TARGET_BRANCH=$(System.PullRequest.TargetBranch 2>/dev/null)
8486
8587
ls ~/.m2/repository/com/microsoft/azure/azure-toolkit-*
8688
cd ..
8789
git clone https://github.com/microsoft/azure-maven-plugins.git
8890
cd azure-maven-plugins/azure-toolkit-libs
8991
90-
echo "build azure-toolkit-libs: $TARGET_BRANCH"
91-
git fetch origin $TARGET_BRANCH
92-
git checkout $TARGET_BRANCH
92+
custom_existed_in_remote=$(git ls-remote --heads origin ${CUSTOM_BRANCH})
93+
source_existed_in_remote=$(git ls-remote --heads origin ${SOURCE_BRANCH})
94+
target_existed_in_remote=$(git ls-remote --heads origin ${TARGET_BRANCH})
95+
if [[ -n ${custom_existed_in_remote} ]]; then
96+
BRANCH=$CUSTOM_BRANCH
97+
elif [[ -n ${source_existed_in_remote} ]]; then
98+
BRANCH=$SOURCE_BRANCH
99+
elif [[ -n ${target_existed_in_remote} ]]; then
100+
BRANCH=$TARGET_BRANCH
101+
fi
102+
103+
echo "build azure-toolkit-libs: $BRANCH"
104+
git fetch origin $BRANCH
105+
git checkout $BRANCH
93106
94107
git branch
95108
mvn clean install -T 4 -Dmaven.test.skip=true -Dmdep.analyze.skip=true -Dmaven.source.skip=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip -B|| exit -1

0 commit comments

Comments
 (0)