Skip to content

Commit 5b19dc0

Browse files
committed
Allow forcing a build in artifacts workflow dispatch
Sometimes it is useful to bypass the revision check when we need to make changes to the runtime_commit_artifacts script. The `force` input can be passed via the GitHub UI for manual runs of the workflow. ghstack-source-id: cf9e32c Pull Request resolved: #31027
1 parent 79bcf6e commit 5b19dc0

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

.github/workflows/runtime_commit_artifacts.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
commit_sha:
1212
required: false
1313
type: string
14+
force:
15+
description: 'Force a commit to the builds/... branches'
16+
required: true
17+
default: false
18+
type: boolean
1419

1520
env:
1621
TZ: /usr/share/zoneinfo/America/Los_Angeles
@@ -196,6 +201,7 @@ jobs:
196201
grep -rl "$CURRENT_VERSION_MODERN" ./compiled | xargs -r sed -i -e "s/$CURRENT_VERSION_MODERN/$LAST_VERSION_MODERN/g"
197202
grep -rl "$CURRENT_VERSION_MODERN" ./compiled || echo "Modern version reverted"
198203
- name: Check for changes
204+
if: !inputs.force
199205
id: check_should_commit
200206
run: |
201207
echo "Full git status"
@@ -213,7 +219,7 @@ jobs:
213219
echo "should_commit=false" >> "$GITHUB_OUTPUT"
214220
fi
215221
- name: Re-apply version changes
216-
if: steps.check_should_commit.outputs.should_commit == 'true' && needs.download_artifacts.outputs.last_version_classic != '' && needs.download_artifacts.outputs.last_version_modern != ''
222+
if: inputs.force || (steps.check_should_commit.outputs.should_commit == 'true' && needs.download_artifacts.outputs.last_version_classic != '' && needs.download_artifacts.outputs.last_version_modern != '')
217223
env:
218224
CURRENT_VERSION_CLASSIC: ${{ needs.download_artifacts.outputs.current_version_classic }}
219225
CURRENT_VERSION_MODERN: ${{ needs.download_artifacts.outputs.current_version_modern }}
@@ -230,12 +236,12 @@ jobs:
230236
grep -rl "$LAST_VERSION_MODERN" ./compiled | xargs -r sed -i -e "s/$LAST_VERSION_MODERN/$CURRENT_VERSION_MODERN/g"
231237
grep -rl "$LAST_VERSION_MODERN" ./compiled || echo "Classic version re-applied"
232238
- name: Will commit these changes
233-
if: steps.check_should_commit.outputs.should_commit == 'true'
239+
if: inputs.force || steps.check_should_commit.outputs.should_commit == 'true'
234240
run: |
235241
echo ":"
236242
git status -u
237243
- name: Commit changes to branch
238-
if: steps.check_should_commit.outputs.should_commit == 'true'
244+
if: inputs.force || steps.check_should_commit.outputs.should_commit == 'true'
239245
uses: stefanzweifel/git-auto-commit-action@v4
240246
with:
241247
commit_message: |
@@ -272,6 +278,7 @@ jobs:
272278
grep -rl "$CURRENT_VERSION" ./compiled-rn | xargs -r sed -i -e "s/$CURRENT_VERSION/$LAST_VERSION/g"
273279
grep -rl "$CURRENT_VERSION" ./compiled-rn || echo "Version reverted"
274280
- name: Check for changes
281+
if: !inputs.force
275282
id: check_should_commit
276283
run: |
277284
echo "Full git status"
@@ -290,7 +297,7 @@ jobs:
290297
echo "should_commit=false" >> "$GITHUB_OUTPUT"
291298
fi
292299
- name: Re-apply version changes
293-
if: steps.check_should_commit.outputs.should_commit == 'true' && needs.download_artifacts.outputs.last_version_rn != ''
300+
if: inputs.force || (steps.check_should_commit.outputs.should_commit == 'true' && needs.download_artifacts.outputs.last_version_rn != '')
294301
env:
295302
CURRENT_VERSION: ${{ needs.download_artifacts.outputs.current_version_rn }}
296303
LAST_VERSION: ${{ needs.download_artifacts.outputs.last_version_rn }}
@@ -300,12 +307,12 @@ jobs:
300307
grep -rl "$LAST_VERSION" ./compiled-rn | xargs -r sed -i -e "s/$LAST_VERSION/$CURRENT_VERSION/g"
301308
grep -rl "$LAST_VERSION" ./compiled-rn || echo "Version re-applied"
302309
- name: Add files for signing
303-
if: steps.check_should_commit.outputs.should_commit == 'true'
310+
if: inputs.force || steps.check_should_commit.outputs.should_commit == 'true'
304311
run: |
305312
echo ":"
306313
git add .
307314
- name: Signing files
308-
if: steps.check_should_commit.outputs.should_commit == 'true'
315+
if: inputs.force || steps.check_should_commit.outputs.should_commit == 'true'
309316
uses: actions/github-script@v7
310317
with:
311318
script: |
@@ -388,12 +395,12 @@ jobs:
388395
console.error('Error signing files:', e);
389396
}
390397
- name: Will commit these changes
391-
if: steps.check_should_commit.outputs.should_commit == 'true'
398+
if: inputs.force || steps.check_should_commit.outputs.should_commit == 'true'
392399
run: |
393400
git add .
394401
git status
395402
- name: Commit changes to branch
396-
if: steps.check_should_commit.outputs.should_commit == 'true'
403+
if: inputs.force || steps.check_should_commit.outputs.should_commit == 'true'
397404
uses: stefanzweifel/git-auto-commit-action@v4
398405
with:
399406
commit_message: |

0 commit comments

Comments
 (0)