Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/forge.func
Original file line number Diff line number Diff line change
Expand Up @@ -1556,9 +1556,10 @@ _forge_release_json() {
# The maintainer's own "latest" marking beats anything the tag strings can
# tell us: it is what separates a release line from nightlies, betas and a
# second product's tags in the same repo, none of which are reliably
# flagged prerelease. Only the unfiltered, stable case can use it.
if [[ -z "$tag_prefix" && "${GH_INCLUDE_PRERELEASE:-0}" != "1" ]] &&
_forge_designated_release "$forge" "$base" "$repo_path" "$out"; then
# flagged prerelease. Only the stable case can use it; a tag prefix only when that release carries it.
if [[ "${GH_INCLUDE_PRERELEASE:-0}" != "1" ]] &&
_forge_designated_release "$forge" "$base" "$repo_path" "$out" &&
[[ -z "$tag_prefix" || "$(jq -r '.tag_name // ""' "$out" 2>/dev/null)" == "$tag_prefix"* ]]; then
[[ "$forge" == "github" ]] && _forge_keep_raw "$out"
return 0
fi
Expand Down
13 changes: 13 additions & 0 deletions tests/forge-release-json.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ expect "the designated release still resolves" 0 "$?"
expect "the designated release is used" v3.0.0 "$(jq -r .tag_name "$OUT")"
expect "only one request was needed" 1 "$(grep -c curl "$CALLS")"

prefixed() {
: >"$CALLS"
: >"$OUT"
_forge_release_json github maplibre/martin latest "martin-v" "$OUT"
}
MOCK_LATEST_CODE=200 MOCK_LATEST_BODY='{"tag_name":"martin-v1.16.1","draft":false,"prerelease":false}' \
MOCK_BODY='[{"tag_name":"mbtiles-v0.15.0","draft":false,"prerelease":false}]' prefixed
expect "a prefix takes the designated release when it carries the prefix" martin-v1.16.1 "$(jq -r .tag_name "$OUT")"
expect "without asking for the list" 1 "$(grep -c curl "$CALLS")"
MOCK_LATEST_CODE=200 MOCK_LATEST_BODY='{"tag_name":"mbtiles-v0.15.0","draft":false,"prerelease":false}' \
MOCK_BODY='[{"tag_name":"martin-v1.16.1","draft":false,"prerelease":false},{"tag_name":"mbtiles-v0.15.0","draft":false,"prerelease":false}]' prefixed
expect "another product's designated release falls back to the list" martin-v1.16.1 "$(jq -r .tag_name "$OUT")"

# databasement: without jq the prefixed lookup read "no tags" and built a URL without a version.
(
ensure_dependencies() {
Expand Down
Loading