@samitouri / QOS-React / commits / 6c6699f3d2

[ci] Don't use third party action to push commits (#32648)

In light of recent third party actions being compromised, let's just push the commit ourselves rather than use a third party action. We already detect if changes are needed, so the step will only run if so. I also added a `dry_run` option to the manual runs of this workflow for testing. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32648). * #32650 * #32649 * __->__ #32648

lauren committed Mar 17, 2025 at 14:13 UTC 6c6699f3d2d15428575005a037b73bcb0b5bd0e4
1 file changed +23 -18
.github/workflows/runtime_commit_artifacts.yml
+23 -18
@@ -16,6 +16,11 @@ on:
16 required: true
17 default: false
18 type: boolean
19 + dry_run:
20 + description: Perform a dry run (run everything except push)
21 + required: true
22 + default: false
23 + type: boolean
24
25 env:
26 TZ: /usr/share/zoneinfo/America/Los_Angeles
@@ -246,16 +251,16 @@ jobs:
251 git status -u
252 - name: Commit changes to branch
253 if: inputs.force == true || steps.check_should_commit.outputs.should_commit == 'true'
249 - uses: stefanzweifel/git-auto-commit-action@v5
250 - with:
251 - commit_message: |
252 - ${{ github.event.workflow_run.head_commit.message || format('Manual build of {0}', github.event.workflow_run.head_sha || github.sha) }}
254 + run: |
255 + git config --global user.email "${{ format('{0}@users.noreply.github.com', github.triggering_actor) }}"
256 + git config --global user.name "${{ github.triggering_actor }}"
257
254 - 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 }})
255 - branch: builds/facebook-www
256 - commit_user_name: ${{ github.triggering_actor }}
257 - commit_user_email: ${{ format('{0}@users.noreply.github.com', github.triggering_actor) }}
258 - create_branch: true
258 + git commit -m "${{ github.event.workflow_run.head_commit.message || format('Manual build of {0}', github.event.workflow_run.head_sha || github.sha) }}
259 +
260 + 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"
261 + - name: Push changes to branch
262 + if: inputs.dry_run == false && (inputs.force == true || steps.check_should_commit.outputs.should_commit == 'true')
263 + run: git push
264
265 commit_fbsource_artifacts:
266 needs: download_artifacts
@@ -413,13 +418,13 @@ jobs:
418 git status
419 - name: Commit changes to branch
420 if: inputs.force == true || steps.check_should_commit.outputs.should_commit == 'true'
416 - uses: stefanzweifel/git-auto-commit-action@v5
417 - with:
418 - commit_message: |
419 - ${{ github.event.workflow_run.head_commit.message || format('Manual build of {0}', github.event.workflow_run.head_sha || github.sha) }}
421 + run: |
422 + git config --global user.email "${{ format('{0}@users.noreply.github.com', github.triggering_actor) }}"
423 + git config --global user.name "${{ github.triggering_actor }}"
424 +
425 + git commit -m "${{ github.event.workflow_run.head_commit.message || format('Manual build of {0}', github.event.workflow_run.head_sha || github.sha) }}
426
421 - 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 }})
422 - branch: builds/facebook-fbsource
423 - commit_user_name: ${{ github.triggering_actor }}
424 - commit_user_email: ${{ format('{0}@users.noreply.github.com', github.triggering_actor) }}
425 - create_branch: true
427 + 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"
428 + - name: Push changes to branch
429 + if: inputs.dry_run == false && (inputs.force == true || steps.check_should_commit.outputs.should_commit == 'true')
430 + run: git push