77 workflow_dispatch :
88 inputs :
99 ref :
10- description : " Git ref to benchmark"
10+ description : " Git ref to benchmark; defaults to the version input, then the selected workflow ref "
1111 required : false
12- default : " main "
12+ default : " "
1313 version :
1414 description : " Version label to publish; defaults to the selected ref"
1515 required : false
1616 default : " "
1717 pattern :
18- description : " JMH benchmark pattern"
18+ description : " JMH benchmark pattern; defaults to all benchmarks "
1919 required : false
20- default : " JRTCompare2Benchmark "
20+ default : " .* "
2121 jmhArgs :
2222 description : " Extra JMH arguments; when provided, CLI options override benchmark annotations"
2323 required : false
@@ -33,7 +33,7 @@ concurrency:
3333 cancel-in-progress : false
3434
3535env :
36- DEFAULT_JMH_PATTERN : JRTCompare2Benchmark
36+ DEFAULT_JMH_PATTERN : .*
3737 BENCHMARK_SITE_URL : https://jawk.io/
3838
3939jobs :
4646 publish : ${{ steps.select.outputs.publish }}
4747
4848 steps :
49- - name : Checkout repository
49+ - name : Checkout selected benchmark ref
50+ if : github.event_name == 'workflow_dispatch'
51+ uses : actions/checkout@v6
52+ with :
53+ fetch-depth : 0
54+ ref : ${{ inputs.ref || inputs.version || github.ref }}
55+
56+ - name : Checkout triggering ref
57+ if : github.event_name != 'workflow_dispatch'
5058 uses : actions/checkout@v6
5159 with :
5260 fetch-depth : 0
7583 jmh_args=""
7684 publish="true"
7785 else
78- ref="${INPUT_REF}"
86+ ref="${INPUT_REF:-${INPUT_VERSION:-${GITHUB_REF_NAME}} }"
7987 version="${INPUT_VERSION}"
8088 pattern="${INPUT_PATTERN}"
8189 jmh_args="${INPUT_JMH_ARGS}"
9199 if [ -z "${pattern}" ]; then
92100 pattern="${DEFAULT_JMH_PATTERN}"
93101 fi
94- if [[ "${ref}" == -* ]]; then
95- echo "Benchmark ref must not start with '-'." >&2
96- exit 1
97- fi
98-
99- git fetch --tags --force origin
100- if commit="$(git rev-parse --verify --quiet -- "${ref}^{commit}")"; then
101- git checkout --detach "${commit}"
102- else
103- git fetch origin -- "${ref}"
104- commit="$(git rev-parse --verify --quiet -- "FETCH_HEAD^{commit}")"
105- git checkout --detach "${commit}"
106- fi
107-
108102 safe_version="$(printf '%s' "${version}" | tr '/\\ ' '---' | tr -cd 'A-Za-z0-9._-')"
109103 if [ -z "${safe_version}" ]; then
110104 safe_version="$(git rev-parse --short HEAD)"
0 commit comments