Skip to content

Commit 0b82ee4

Browse files
Copilotpetesramek
andauthored
fix(backtrack): lock all target branches upfront, unlock one-at-a-time for each merge
Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/5ea2e5f9-89e1-4d12-8aeb-bc33b2df85b3 Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com>
1 parent fa8cf1d commit 0b82ee4

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/backtrack.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,32 @@ jobs:
6969
token: ${{ secrets.GH_ADMIN_TOKEN }}
7070
lock-branch: 'true'
7171

72+
- name: 'Lock preview branch'
73+
id: lock-preview
74+
if: ${{ steps.targets.outputs.preview-branch != '' }}
75+
uses: './.github/actions/github/branch-protection/lock'
76+
with:
77+
branch: ${{ steps.targets.outputs.preview-branch }}
78+
token: ${{ secrets.GH_ADMIN_TOKEN }}
79+
lock-branch: 'true'
80+
81+
- name: 'Lock develop branch'
82+
id: lock-develop
83+
if: ${{ steps.check-develop.outputs.exists == 'true' }}
84+
uses: './.github/actions/github/branch-protection/lock'
85+
with:
86+
branch: ${{ steps.targets.outputs.develop-branch }}
87+
token: ${{ secrets.GH_ADMIN_TOKEN }}
88+
lock-branch: 'true'
89+
90+
- name: 'Unlock preview branch for merge'
91+
if: ${{ steps.targets.outputs.preview-branch != '' }}
92+
uses: './.github/actions/github/branch-protection/lock'
93+
with:
94+
branch: ${{ steps.targets.outputs.preview-branch }}
95+
token: ${{ secrets.GH_ADMIN_TOKEN }}
96+
lock-branch: 'false'
97+
7298
- name: 'Backtrack: merge ${{ github.base_ref }} into ${{ steps.targets.outputs.preview-branch }}'
7399
if: ${{ steps.targets.outputs.preview-branch != '' }}
74100
env:
@@ -79,6 +105,14 @@ jobs:
79105
--field head="${{ github.base_ref }}" \
80106
--field commit_message="Backtrack: merge ${{ github.base_ref }} into ${{ steps.targets.outputs.preview-branch }}"
81107
108+
- name: 'Unlock develop branch for merge'
109+
if: ${{ steps.check-develop.outputs.exists == 'true' }}
110+
uses: './.github/actions/github/branch-protection/lock'
111+
with:
112+
branch: ${{ steps.targets.outputs.develop-branch }}
113+
token: ${{ secrets.GH_ADMIN_TOKEN }}
114+
lock-branch: 'false'
115+
82116
- name: 'Backtrack: merge ${{ steps.targets.outputs.merge-source }} into ${{ steps.targets.outputs.develop-branch }}'
83117
if: ${{ steps.check-develop.outputs.exists == 'true' }}
84118
env:
@@ -97,6 +131,22 @@ jobs:
97131
token: ${{ secrets.GH_ADMIN_TOKEN }}
98132
lock-branch: 'false'
99133

134+
- name: 'Restore protection: preview branch'
135+
if: ${{ always() && steps.lock-preview.outcome == 'success' }}
136+
uses: './.github/actions/github/branch-protection/lock'
137+
with:
138+
branch: ${{ steps.targets.outputs.preview-branch }}
139+
token: ${{ secrets.GH_ADMIN_TOKEN }}
140+
lock-branch: 'false'
141+
142+
- name: 'Restore protection: develop branch'
143+
if: ${{ always() && steps.lock-develop.outcome == 'success' }}
144+
uses: './.github/actions/github/branch-protection/lock'
145+
with:
146+
branch: ${{ steps.targets.outputs.develop-branch }}
147+
token: ${{ secrets.GH_ADMIN_TOKEN }}
148+
lock-branch: 'false'
149+
100150
- name: 'Write backtrack summary'
101151
if: ${{ always() }}
102152
run: |

0 commit comments

Comments
 (0)