From 8cbc27b92cd7258991aca2735e4b760c827244d9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 4 Apr 2026 14:07:12 +0000 Subject: [PATCH] fix: temporarily remove PR review requirements during backtrack merge The GitHub Merges API returns 403 when the target branch has required_pull_request_reviews + enforce_admins:true, even for the repo owner. Add skip-pull-request-reviews input to the lock action to set required_pull_request_reviews:null before the automated merge, allowing the Merges API to proceed. The restore steps re-apply the PR review requirement afterward. Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/e8921bba-9934-4d7d-89d6-3098d2dc674e Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com> --- .github/actions/github/branch-protection/lock/action.yml | 9 +++++++-- .github/workflows/backtrack.yml | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/actions/github/branch-protection/lock/action.yml b/.github/actions/github/branch-protection/lock/action.yml index 1ac85d62..2cc990d6 100644 --- a/.github/actions/github/branch-protection/lock/action.yml +++ b/.github/actions/github/branch-protection/lock/action.yml @@ -24,6 +24,10 @@ inputs: description: 'When true, repository admins are exempt from all branch protection rules (enforce_admins is disabled). When false (default), admins are also subject to the rules.' required: false default: 'false' + skip-pull-request-reviews: + description: 'When true, sets required_pull_request_reviews to null (removes PR review requirement). Use temporarily before automated merges so the merge API is not blocked. When false (default), PR reviews are required as configured.' + required: false + default: 'false' runs: using: composite @@ -43,14 +47,15 @@ runs: --argjson dismiss_stale '${{ inputs.dismiss-stale-reviews }}' \ --argjson enforce_admins "$ENFORCE_ADMINS" \ --argjson lock_branch '${{ inputs.lock-branch }}' \ + --argjson skip_reviews '${{ inputs.skip-pull-request-reviews }}' \ '{ "required_status_checks": null, "enforce_admins": $enforce_admins, - "required_pull_request_reviews": { + "required_pull_request_reviews": (if $skip_reviews then null else { "dismiss_stale_reviews": $dismiss_stale, "require_code_owner_reviews": false, "required_approving_review_count": $review_count - }, + } end), "restrictions": null, "allow_force_pushes": false, "allow_deletions": false, diff --git a/.github/workflows/backtrack.yml b/.github/workflows/backtrack.yml index 0e971f42..74946fa1 100644 --- a/.github/workflows/backtrack.yml +++ b/.github/workflows/backtrack.yml @@ -94,6 +94,7 @@ jobs: branch: ${{ steps.targets.outputs.preview-branch }} token: ${{ secrets.GH_ADMIN_TOKEN }} lock-branch: 'false' + skip-pull-request-reviews: 'true' - name: 'Backtrack: merge ${{ github.base_ref }} into ${{ steps.targets.outputs.preview-branch }}' if: ${{ steps.targets.outputs.preview-branch != '' }} @@ -112,6 +113,7 @@ jobs: branch: ${{ steps.targets.outputs.develop-branch }} token: ${{ secrets.GH_ADMIN_TOKEN }} lock-branch: 'false' + skip-pull-request-reviews: 'true' - name: 'Backtrack: merge ${{ steps.targets.outputs.merge-source }} into ${{ steps.targets.outputs.develop-branch }}' if: ${{ steps.check-develop.outputs.exists == 'true' }}