Skip to content

Commit 70dcc81

Browse files
authored
fix: backtrack workflow leaves concrete branch rules behind after automated merges (#193)
The backtrack workflow locked concrete branches (e.g., `preview/1.0`, `develop/1.0`) during automated merges but never properly cleaned them up — the "restore" steps called the `lock` action with `lock-branch: false`, which issues a `PUT` that modifies the rule but leaves the full protection ruleset in place. Branches with no prior protection ended up permanently protected after each run. ## Changes - **`backtrack.yml`** — Replace all three "Restore protection" steps with the `unlock` action (`DELETE /branches/{branch}/protection`) instead of `lock` with `lock-branch: false` (`PUT /branches/{branch}/protection`). Concrete per-branch rules are fully removed after the merge; the manually-maintained glob pattern rules (`develop/**`, `preview/**`, `release/**`) remain as the base protection. ```yaml # Before — PUT: flips lock_branch off but leaves the full ruleset behind - uses: './.github/actions/github/branch-protection/lock' with: branch: ${{ steps.targets.outputs.develop-branch }} token: ${{ secrets.GH_ADMIN_TOKEN }} lock-branch: 'false' # After — DELETE: removes the temporary concrete rule entirely - uses: './.github/actions/github/branch-protection/unlock' with: branch: ${{ steps.targets.outputs.develop-branch }} token: ${{ secrets.GH_ADMIN_TOKEN }} fail-on-error: 'true' ```
1 parent 29b9131 commit 70dcc81

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

.github/workflows/backtrack.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,27 +127,27 @@ jobs:
127127
128128
- name: 'Restore protection: base branch'
129129
if: ${{ always() && steps.lock-base.outcome == 'success' }}
130-
uses: './.github/actions/github/branch-protection/lock'
130+
uses: './.github/actions/github/branch-protection/unlock'
131131
with:
132132
branch: ${{ github.base_ref }}
133133
token: ${{ secrets.GH_ADMIN_TOKEN }}
134-
lock-branch: 'false'
134+
fail-on-error: 'true'
135135

136136
- name: 'Restore protection: preview branch'
137137
if: ${{ always() && steps.lock-preview.outcome == 'success' }}
138-
uses: './.github/actions/github/branch-protection/lock'
138+
uses: './.github/actions/github/branch-protection/unlock'
139139
with:
140140
branch: ${{ steps.targets.outputs.preview-branch }}
141141
token: ${{ secrets.GH_ADMIN_TOKEN }}
142-
lock-branch: 'false'
142+
fail-on-error: 'true'
143143

144144
- name: 'Restore protection: develop branch'
145145
if: ${{ always() && steps.lock-develop.outcome == 'success' }}
146-
uses: './.github/actions/github/branch-protection/lock'
146+
uses: './.github/actions/github/branch-protection/unlock'
147147
with:
148148
branch: ${{ steps.targets.outputs.develop-branch }}
149149
token: ${{ secrets.GH_ADMIN_TOKEN }}
150-
lock-branch: 'false'
150+
fail-on-error: 'true'
151151

152152
- name: 'Write backtrack summary'
153153
if: ${{ always() }}

0 commit comments

Comments
 (0)