Merge pull request 'fix: fix: dev-poll abandons fresh PRs — stale branch check fails on unfetched refs (#248)' (#250) from fix/issue-248 into main
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
This commit is contained in:
commit
6d1b464bbd
1 changed files with 5 additions and 2 deletions
|
|
@ -371,6 +371,9 @@ if [ -f "$LOCKFILE" ]; then
|
||||||
rm -f "$LOCKFILE"
|
rm -f "$LOCKFILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# --- Fetch origin refs before any stale branch checks ---
|
||||||
|
git fetch origin --prune 2>/dev/null || true
|
||||||
|
|
||||||
# --- Memory guard ---
|
# --- Memory guard ---
|
||||||
memory_guard 2000
|
memory_guard 2000
|
||||||
|
|
||||||
|
|
@ -430,7 +433,7 @@ if [ "$ORPHAN_COUNT" -gt 0 ]; then
|
||||||
if [ -n "$HAS_PR" ]; then
|
if [ -n "$HAS_PR" ]; then
|
||||||
# Check if branch is stale (behind primary branch)
|
# Check if branch is stale (behind primary branch)
|
||||||
BRANCH="fix/issue-${ISSUE_NUM}"
|
BRANCH="fix/issue-${ISSUE_NUM}"
|
||||||
AHEAD=$(git rev-list --count "origin/${BRANCH}..origin/${PRIMARY_BRANCH}" 2>/dev/null || echo "999")
|
AHEAD=$(git rev-list --count "origin/${BRANCH}..origin/${PRIMARY_BRANCH}" 2>/dev/null || echo "0")
|
||||||
if [ "$AHEAD" -gt 0 ]; then
|
if [ "$AHEAD" -gt 0 ]; then
|
||||||
log "issue #${ISSUE_NUM} PR #${HAS_PR} is $AHEAD commits behind ${PRIMARY_BRANCH} — abandoning stale PR"
|
log "issue #${ISSUE_NUM} PR #${HAS_PR} is $AHEAD commits behind ${PRIMARY_BRANCH} — abandoning stale PR"
|
||||||
# Close the PR via API
|
# Close the PR via API
|
||||||
|
|
@ -682,7 +685,7 @@ for i in $(seq 0 $((BACKLOG_COUNT - 1))); do
|
||||||
if [ -n "$EXISTING_PR" ]; then
|
if [ -n "$EXISTING_PR" ]; then
|
||||||
# Check if branch is stale (behind primary branch)
|
# Check if branch is stale (behind primary branch)
|
||||||
BRANCH="fix/issue-${ISSUE_NUM}"
|
BRANCH="fix/issue-${ISSUE_NUM}"
|
||||||
AHEAD=$(git rev-list --count "origin/${BRANCH}..origin/${PRIMARY_BRANCH}" 2>/dev/null || echo "999")
|
AHEAD=$(git rev-list --count "origin/${BRANCH}..origin/${PRIMARY_BRANCH}" 2>/dev/null || echo "0")
|
||||||
if [ "$AHEAD" -gt 0 ]; then
|
if [ "$AHEAD" -gt 0 ]; then
|
||||||
log "issue #${ISSUE_NUM} PR #${EXISTING_PR} is $AHEAD commits behind ${PRIMARY_BRANCH} — abandoning stale PR"
|
log "issue #${ISSUE_NUM} PR #${EXISTING_PR} is $AHEAD commits behind ${PRIMARY_BRANCH} — abandoning stale PR"
|
||||||
# Close the PR via API
|
# Close the PR via API
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue