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
11 changes: 9 additions & 2 deletions .github/workflows/branch-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,15 @@ jobs:
;;
esac

# Pull this branch's full PR history (open + closed + merged) in one call.
prs_json=$(gh api "repos/$REPO/pulls" -f "head=$OWNER:$branch" -f state=all --jq '.' 2>/dev/null || echo '[]')
# Pull this branch's full PR history (open + closed + merged) in one call. --method GET is
# required: gh api sends -f fields as a POST body unless told otherwise, which would hit the
# create-a-pull-request endpoint instead of listing. When the lookup fails the branch is left
# alone: without its PRs the open-PR and protect-label rules cannot be checked.
if ! prs_json=$(gh api --method GET "repos/$REPO/pulls" -f "head=$OWNER:$branch" -f state=all -f per_page=100 2>/dev/null); then
row "$branch" "Kept" "PR lookup failed" "left alone: its PRs could not be read"
kept=$((kept + 1))
continue
fi

has_open=$(echo "$prs_json" | jq -r 'any(.[]; .state == "open")')
if [ "$has_open" = "true" ]; then
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ follows [Semantic Versioning](https://semver.org/).

## [Unreleased]

### Fixed (Branch cleanup — `bugfix/147-branch-cleanup-pulls`, #147)
- The weekly branch cleanup read each branch's pull requests with `gh api -f`, which sends a POST to the create-pull-request endpoint instead of listing, so every lookup failed with 422 and the open-PR and `do-not-delete` protections were never checked. It now lists with `--method GET`, and a branch whose PRs cannot be read is left alone.

### Fixed (OpenAPI groups — `bugfix/149-openapi-groups`, #149)
- Swagger UI now has groups for `codebase` (code copilot and GitHub), `gateway` (Jira integrations), `overview` and `search`; before, only workspace, discovery, iam and billing were documented, so those endpoints were missing from `/swagger-ui.html` and `/api-docs/*`.

Expand Down
Loading