File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 55 runs-on : ubuntu-latest
66 steps :
77 - uses : actions/checkout@v4
8+ with :
9+ fetch-depth : 0
10+ - name : Print current branch
11+ run : |
12+ echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
813 - name : Validate Plugin Version
914 uses : ./
1015 with :
Original file line number Diff line number Diff line change @@ -7,15 +7,20 @@ main() {
77 DEFAULT_BRANCH=$( git remote show origin | grep ' HEAD branch' | cut -d' ' -f5)
88 echo " Default branch is $DEFAULT_BRANCH "
99
10- # Check out the specified branch if $BRANCH is set
11- if [[ -n " ${BRANCH:- } " ]]; then
10+ # Check out the specified branch if $BRANCH is set and not already on it
11+ if [[ -n " ${BRANCH:- } " && " $( git rev-parse --abbrev-ref HEAD) " != " $BRANCH " ]]; then
12+ echo " Checking if branch $BRANCH exists."
13+ if ! git show-ref --verify --quiet " refs/heads/$BRANCH " ; then
14+ echo " Error: Branch '$BRANCH ' does not exist."
15+ exit 1
16+ fi
1217 echo " Checking out branch $BRANCH "
1318 git checkout " $BRANCH "
1419 fi
1520
1621 # If $PLUGIN_PATH is defined, echo it.
1722 if [[ -n " ${PLUGIN_PATH:- } " ]]; then
18- PLUGIN_PATH=${WORKFLOW_PATH} /${PLUGIN_PATH}
23+ PLUGIN_PATH=${WORKFLOW_PATH} /${PLUGIN_PATH}
1924 echo " Plugin path: $PLUGIN_PATH "
2025 else
2126 local PLUGIN_PATH
You can’t perform that action at this time.
0 commit comments