Skip to content

Commit a17e3ae

Browse files
committed
debug the passed branch
1 parent e91a288 commit a17e3ae

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ jobs:
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:

bin/validate-plugin-version.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)