fix: dep check fallback — also check PR with same number as issue
Codeberg uses shared issue/PR numbering. When a PR IS the dep issue (e.g. PR #665 fixes issue #665), the title search misses it. Fallback checks if pulls/{dep_num} is merged.
This commit is contained in:
parent
b8097f1144
commit
d61dead3f1
1 changed files with 12 additions and 3 deletions
|
|
@ -60,15 +60,24 @@ dep_is_merged() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check there's a merged PR for this issue
|
# Check there's a merged PR for this issue.
|
||||||
# Search closed PRs for title containing "#NNN" or body containing "Fixes #NNN"
|
# Strategy: search closed PRs for title/body containing "#NNN",
|
||||||
|
# OR check if a PR with the same number exists and is merged.
|
||||||
local has_merged
|
local has_merged
|
||||||
has_merged=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \
|
has_merged=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \
|
||||||
"${API}/pulls?state=closed&limit=30" | \
|
"${API}/pulls?state=closed&limit=30" | \
|
||||||
jq -r --arg num "#${dep_num}" \
|
jq -r --arg num "#${dep_num}" \
|
||||||
'[.[] | select(.merged == true) | select((.title | contains($num)) or (.body // "" | test("ixes " + $num + "\\b"; "i")))] | length')
|
'[.[] | select(.merged == true) | select((.title | contains($num)) or (.body // "" | test("ixes " + $num + "\\b"; "i")))] | length')
|
||||||
|
|
||||||
[ "${has_merged:-0}" -gt 0 ]
|
if [ "${has_merged:-0}" -gt 0 ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fallback: check if PR with same number is merged (Codeberg uses shared numbering)
|
||||||
|
local same_pr_merged
|
||||||
|
same_pr_merged=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \
|
||||||
|
"${API}/pulls/${dep_num}" 2>/dev/null | jq -r '.merged // false')
|
||||||
|
[ "$same_pr_merged" = "true" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue