mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-08-27 14:17:10 -04:00
ci: keep ready label off changes-requested PRs
This commit is contained in:
parent
1deb947ac1
commit
595b709a5b
2 changed files with 18 additions and 9 deletions
19
.github/workflows/pr-health.yml
vendored
19
.github/workflows/pr-health.yml
vendored
|
|
@ -196,12 +196,13 @@ jobs:
|
|||
fi
|
||||
|
||||
for pr in $pr_numbers; do
|
||||
data="$(gh pr view "$pr" --repo "$REPO" \
|
||||
--json isDraft,labels,mergeStateStatus,statusCheckRollup)"
|
||||
|
||||
merge_state="$(jq -r '.mergeStateStatus // "UNKNOWN"' <<<"$data")"
|
||||
check_state="$(python3 .github/scripts/pr-health-labels.py --state-json "$data")"
|
||||
is_draft="$(jq -r '.isDraft' <<<"$data")"
|
||||
data="$(gh pr view "$pr" --repo "$REPO" \
|
||||
--json isDraft,labels,mergeStateStatus,reviewDecision,statusCheckRollup)"
|
||||
|
||||
merge_state="$(jq -r '.mergeStateStatus // "UNKNOWN"' <<<"$data")"
|
||||
check_state="$(python3 .github/scripts/pr-health-labels.py --state-json "$data")"
|
||||
is_draft="$(jq -r '.isDraft' <<<"$data")"
|
||||
review_decision="$(jq -r '.reviewDecision // ""' <<<"$data")"
|
||||
|
||||
if [[ "$merge_state" == "BEHIND" ]]; then
|
||||
gh pr edit "$pr" --repo "$REPO" --add-label "status: needs rebase"
|
||||
|
|
@ -221,7 +222,7 @@ jobs:
|
|||
gh pr edit "$pr" --repo "$REPO" --remove-label "status: ci failing" || true
|
||||
fi
|
||||
|
||||
if [[ "$merge_state" == "BEHIND" || "$merge_state" == "DIRTY" || "$check_state" == "failing" || "$is_draft" == "true" ]]; then
|
||||
gh pr edit "$pr" --repo "$REPO" --remove-label "status: ready for review" || true
|
||||
fi
|
||||
if [[ "$merge_state" == "BEHIND" || "$merge_state" == "DIRTY" || "$check_state" == "failing" || "$is_draft" == "true" || "$review_decision" == "CHANGES_REQUESTED" ]]; then
|
||||
gh pr edit "$pr" --repo "$REPO" --remove-label "status: ready for review" || true
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
|
|
@ -14,3 +14,11 @@ def test_incomplete_pr_template_is_reported_without_failing_job() -> None:
|
|||
assert "PR template validation found missing fields" in workflow
|
||||
assert "Fail when the PR body is incomplete" not in workflow
|
||||
assert 'echo "PR template validation failed' not in workflow
|
||||
|
||||
|
||||
def test_ready_for_review_label_is_removed_when_changes_are_requested() -> None:
|
||||
workflow = Path(".github/workflows/pr-health.yml").read_text(encoding="utf-8")
|
||||
|
||||
assert "reviewDecision" in workflow
|
||||
assert 'review_decision="$(jq -r \'.reviewDecision // ""\'' in workflow
|
||||
assert '$review_decision" == "CHANGES_REQUESTED"' in workflow
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue