[ci] Properly format commit message (#32668)
Using the github variable for the commit message replaces the variable inline. If the commit message contains quotes or other characters that need to be escaped, this breaks the workflow. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32668). * #32669 * __->__ #32668
lauren committed
Mar 19, 2025 at 11:49 UTC
646835fb59f9ad8557b9f3641515697c153e3faa
1 file changed
+2
-6
.github/workflows/runtime_commit_artifacts.yml
+2
-6
@@ -252,9 +252,7 @@ jobs:
252
git config --global user.email "${{ format('{0}@users.noreply.github.com', github.triggering_actor) }}"
253
git config --global user.name "${{ github.triggering_actor }}"
254
255
- git commit -m "${{ github.event.workflow_run.head_commit.message || format('Manual build of {0}', github.event.workflow_run.head_sha || github.sha) }}
256
-
257
- DiffTrain build for [${{ github.event.workflow_run.head_sha || github.sha }}](https://github.com/facebook/react/commit/${{ github.event.workflow_run.head_sha || github.sha }})" || echo "No changes to commit"
255
+ git commit -m "$(git show --no-patch --pretty=format:'%B%n%nDiffTrain build for [${{ github.event.workflow_run.head_sha || github.sha }}](https://github.com/facebook/react/commit/${{ github.event.workflow_run.head_sha || github.sha}})')" || echo "No changes to commit"
256
- name: Push changes to branch
257
if: inputs.dry_run == false && (inputs.force == true || steps.check_should_commit.outputs.should_commit == 'true')
258
run: git push
@@ -419,9 +417,7 @@ jobs:
417
git config --global user.email "${{ format('{0}@users.noreply.github.com', github.triggering_actor) }}"
418
git config --global user.name "${{ github.triggering_actor }}"
419
422
- git commit -m "${{ github.event.workflow_run.head_commit.message || format('Manual build of {0}', github.event.workflow_run.head_sha || github.sha) }}
423
-
424
- DiffTrain build for [${{ github.event.workflow_run.head_sha || github.sha }}](https://github.com/facebook/react/commit/${{ github.event.workflow_run.head_sha || github.sha }})" || echo "No changes to commit"
420
+ git commit -m "$(git show --no-patch --pretty=format:'%B%n%nDiffTrain build for [${{ github.event.workflow_run.head_sha || github.sha }}](https://github.com/facebook/react/commit/${{ github.event.workflow_run.head_sha || github.sha}})')" || echo "No changes to commit"
421
- name: Push changes to branch
422
if: inputs.dry_run == false && (inputs.force == true || steps.check_should_commit.outputs.should_commit == 'true')
423
run: git push