Skip to content

Commit c5d3d60

Browse files
committed
Add origin target branch to help promote rebased fix branches
1 parent e73c4ec commit c5d3d60

File tree

1 file changed

+42
-23
lines changed

1 file changed

+42
-23
lines changed

.github/workflows/rebase.yml

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ on:
55
- cron: "0 5 * * *"
66
workflow_dispatch:
77
inputs:
8-
origin_branch:
9-
description: 'Name of origin branch that should be rebased onto upstream branch'
8+
origin_source_branch:
9+
description: 'Name of origin source branch that should be rebased onto upstream branch'
10+
required: true
11+
default: 'woarm64'
12+
origin_target_branch:
13+
description: 'Name of origin target branch where rebased source branch will be placed'
1014
required: true
1115
default: 'woarm64'
1216
upstream_branch:
@@ -36,7 +40,8 @@ env:
3640
CYGWIN_UPSTREAM_URL: git://sourceware.org/git/newlib-cygwin.git
3741

3842
SOURCE_PATH: ${{ github.workspace }}/code
39-
ORIGIN_BRANCH: ${{ inputs.origin_branch || 'woarm64' }}
43+
ORIGIN_SOURCE_BRANCH: ${{ inputs.origin_source_branch || 'woarm64' }}
44+
ORIGIN_TARGET_BRANCH: ${{ inputs.origin_target_branch || 'woarm64' }}
4045
UPSTREAM_BRANCH: ${{ inputs.upstream_branch || 'master' }}
4146
REBASE_BRANCH: ${{ inputs.rebase_branch || 'rebase-upstream' }}
4247
BACKUP_BRANCH: ${{ inputs.backup_branch || 'rebase-upstream-backup' }}
@@ -56,7 +61,7 @@ jobs:
5661
with:
5762
token: ${{ secrets.GNU_PUSH_PAT }}
5863
repository: ${{ env.BINUTILS_REPO }}
59-
ref: ${{ env.ORIGIN_BRANCH }}
64+
ref: ${{ env.ORIGIN_SOURCE_BRANCH }}
6065
fetch-depth: 0
6166
path: ${{ env.SOURCE_PATH }}/binutils
6267

@@ -83,7 +88,7 @@ jobs:
8388
with:
8489
token: ${{ secrets.GNU_PUSH_PAT }}
8590
repository: ${{ env.GCC_REPO }}
86-
ref: ${{ env.ORIGIN_BRANCH }}
91+
ref: ${{ env.ORIGIN_SOURCE_BRANCH }}
8792
fetch-depth: 0
8893
path: ${{ env.SOURCE_PATH }}/gcc
8994

@@ -110,7 +115,7 @@ jobs:
110115
with:
111116
token: ${{ secrets.GNU_PUSH_PAT }}
112117
repository: ${{ env.MINGW_REPO }}
113-
ref: ${{ env.ORIGIN_BRANCH }}
118+
ref: ${{ env.ORIGIN_SOURCE_BRANCH }}
114119
fetch-depth: 0
115120
path: ${{ env.SOURCE_PATH }}/mingw
116121

@@ -137,7 +142,7 @@ jobs:
137142
with:
138143
token: ${{ secrets.GNU_PUSH_PAT }}
139144
repository: ${{ env.CYGWIN_REPO }}
140-
ref: ${{ env.ORIGIN_BRANCH }}
145+
ref: ${{ env.ORIGIN_SOURCE_BRANCH }}
141146
fetch-depth: 0
142147
path: ${{ env.SOURCE_PATH }}/cygwin
143148

@@ -164,9 +169,23 @@ jobs:
164169
mingw_branch: ${{ inputs.rebase_branch || 'rebase-upstream' }}
165170
cygwin_branch: ${{ inputs.rebase_branch || 'rebase-upstream' }}
166171

167-
finish-binutils-rebase:
172+
finish-rebase-approval:
173+
name: Request Finish Rebase Approval
174+
if: startsWith(${{ inputs.origin_target_branch || 'woarm64' }}, 'woarm64') && ${{ inputs.origin_target_branch || 'woarm64' }} != ${{ inputs.origin_source_branch || 'woarm64' }}
168175
needs: [build]
169176
runs-on: ubuntu-latest
177+
environment:
178+
name: approval-required
179+
steps:
180+
- name: Approval
181+
run: echo "Approval received. Proceeding with rebasing."
182+
183+
- name: Test
184+
run: exit 1
185+
186+
finish-binutils-rebase:
187+
needs: [finish-rebase-approval]
188+
runs-on: ubuntu-latest
170189

171190
steps:
172191
- name: Checkout repository
@@ -179,19 +198,19 @@ jobs:
179198
with:
180199
token: ${{ secrets.GNU_PUSH_PAT }}
181200
repository: ${{ env.BINUTILS_REPO }}
182-
ref: ${{ env.ORIGIN_BRANCH }}
201+
ref: ${{ env.ORIGIN_TARGET_BRANCH }}
183202
path: ${{ env.SOURCE_PATH }}/binutils
184203

185204
- name: Finish binutils rebase
186205
working-directory: ${{ env.SOURCE_PATH }}/binutils
187206
run: |
188207
${{ github.workspace }}/.github/scripts/rebase-finish.sh \
189208
${{ env.REBASE_BRANCH }} \
190-
${{ env.ORIGIN_BRANCH }} \
209+
${{ env.ORIGIN_TARGET_BRANCH }} \
191210
${{ env.BACKUP_BRANCH }}
192211
193212
finish-gcc-rebase:
194-
needs: [build]
213+
needs: [finish-rebase-approval]
195214
runs-on: ubuntu-latest
196215

197216
steps:
@@ -205,19 +224,19 @@ jobs:
205224
with:
206225
token: ${{ secrets.GNU_PUSH_PAT }}
207226
repository: ${{ env.GCC_REPO }}
208-
ref: ${{ env.ORIGIN_BRANCH }}
227+
ref: ${{ env.ORIGIN_TARGET_BRANCH }}
209228
path: ${{ env.SOURCE_PATH }}/gcc
210229

211230
- name: Finish GCC rebase
212231
working-directory: ${{ env.SOURCE_PATH }}/gcc
213232
run: |
214233
${{ github.workspace }}/.github/scripts/rebase-finish.sh \
215234
${{ env.REBASE_BRANCH }} \
216-
${{ env.ORIGIN_BRANCH }} \
235+
${{ env.ORIGIN_TARGET_BRANCH }} \
217236
${{ env.BACKUP_BRANCH }}
218237
219238
finish-mingw-rebase:
220-
needs: [build]
239+
needs: [finish-rebase-approval]
221240
runs-on: ubuntu-latest
222241

223242
steps:
@@ -231,19 +250,19 @@ jobs:
231250
with:
232251
token: ${{ secrets.GNU_PUSH_PAT }}
233252
repository: ${{ env.MINGW_REPO }}
234-
ref: ${{ env.ORIGIN_BRANCH }}
253+
ref: ${{ env.ORIGIN_TARGET_BRANCH }}
235254
path: ${{ env.SOURCE_PATH }}/mingw
236255

237256
- name: Finish MinGW rebase
238257
working-directory: ${{ env.SOURCE_PATH }}/mingw
239258
run: |
240259
${{ github.workspace }}/.github/scripts/rebase-finish.sh \
241260
${{ env.REBASE_BRANCH }} \
242-
${{ env.ORIGIN_BRANCH }} \
261+
${{ env.ORIGIN_TARGET_BRANCH }} \
243262
${{ env.BACKUP_BRANCH }}
244263
245264
finish-cygwin-rebase:
246-
needs: [build]
265+
needs: [finish-rebase-approval]
247266
runs-on: ubuntu-latest
248267

249268
steps:
@@ -257,15 +276,15 @@ jobs:
257276
with:
258277
token: ${{ secrets.GNU_PUSH_PAT }}
259278
repository: ${{ env.CYGWIN_REPO }}
260-
ref: ${{ env.ORIGIN_BRANCH }}
279+
ref: ${{ env.ORIGIN_TARGET_BRANCH }}
261280
path: ${{ env.SOURCE_PATH }}/cygwin
262281

263282
- name: Finish Cygwin rebase
264283
working-directory: ${{ env.SOURCE_PATH }}/cygwin
265284
run: |
266285
${{ github.workspace }}/.github/scripts/rebase-finish.sh \
267286
${{ env.REBASE_BRANCH }} \
268-
${{ env.ORIGIN_BRANCH }} \
287+
${{ env.ORIGIN_TARGET_BRANCH }} \
269288
${{ env.BACKUP_BRANCH }}
270289
271290
clean-binutils-rebase:
@@ -284,7 +303,7 @@ jobs:
284303
with:
285304
token: ${{ secrets.GNU_PUSH_PAT }}
286305
repository: ${{ env.BINUTILS_REPO }}
287-
ref: ${{ env.ORIGIN_BRANCH }}
306+
ref: ${{ env.ORIGIN_SOURCE_BRANCH }}
288307
fetch-depth: 0
289308
path: ${{ env.SOURCE_PATH }}/binutils
290309

@@ -311,7 +330,7 @@ jobs:
311330
with:
312331
token: ${{ secrets.GNU_PUSH_PAT }}
313332
repository: ${{ env.GCC_REPO }}
314-
ref: ${{ env.ORIGIN_BRANCH }}
333+
ref: ${{ env.ORIGIN_SOURCE_BRANCH }}
315334
fetch-depth: 0
316335
path: ${{ env.SOURCE_PATH }}/gcc
317336

@@ -338,7 +357,7 @@ jobs:
338357
with:
339358
token: ${{ secrets.GNU_PUSH_PAT }}
340359
repository: ${{ env.MINGW_REPO }}
341-
ref: ${{ env.ORIGIN_BRANCH }}
360+
ref: ${{ env.ORIGIN_SOURCE_BRANCH }}
342361
fetch-depth: 0
343362
path: ${{ env.SOURCE_PATH }}/mingw
344363

@@ -365,7 +384,7 @@ jobs:
365384
with:
366385
token: ${{ secrets.GNU_PUSH_PAT }}
367386
repository: ${{ env.CYGWIN_REPO }}
368-
ref: ${{ env.ORIGIN_BRANCH }}
387+
ref: ${{ env.ORIGIN_SOURCE_BRANCH }}
369388
path: ${{ env.SOURCE_PATH }}/cygwin
370389

371390
- name: Clean Cygwin rebase

0 commit comments

Comments
 (0)