Skip to content

Commit 47205a7

Browse files
committed
support arbitrary branches
1 parent 20212c3 commit 47205a7

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

.github/workflows/run-bench.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,34 @@ jobs:
7777
# Parse the branches input and run benchmarks for each branch
7878
- name: Run benchmarks for each branch
7979
run: |
80+
# Debug: Print the branches input
81+
echo "Branches input: '${{ github.event.inputs.branches }}'"
82+
8083
# Get the list of branches to benchmark
81-
IFS=' ' read -r -a BRANCHES <<< "${{ github.event.inputs.branches }}"
84+
# If the input is empty, use the default value from workflow definition
85+
BRANCHES_INPUT="${{ github.event.inputs.branches }}"
86+
if [ -z "$BRANCHES_INPUT" ]; then
87+
echo "No branches specified, using default: 'github_actions main'"
88+
BRANCHES_INPUT="github_actions main"
89+
fi
90+
91+
echo "Parsing branches from: '$BRANCHES_INPUT'"
92+
IFS=' ' read -r -a BRANCHES <<< "$BRANCHES_INPUT"
93+
94+
# Debug: Print the parsed branches
95+
echo "Parsed ${#BRANCHES[@]} branches: ${BRANCHES[*]}"
8296
8397
# Create a directory to store all benchmark results
8498
mkdir -p benchmark_results
8599
100+
# If still no branches, add current branch
101+
if [ ${#BRANCHES[@]} -eq 0 ]; then
102+
echo "No branches parsed, adding current branch"
103+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
104+
BRANCHES=("$CURRENT_BRANCH")
105+
echo "Using current branch: $CURRENT_BRANCH"
106+
fi
107+
86108
# Loop through each branch
87109
for branch in "${BRANCHES[@]}"; do
88110
echo "Processing branch: $branch"

0 commit comments

Comments
 (0)