Skip to content

Commit 6c6699f

Browse files
authored
[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
1 parent 9320a01 commit 6c6699f

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

.github/workflows/runtime_commit_artifacts.yml

+23-18
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
required: true
1717
default: false
1818
type: boolean
19+
dry_run:
20+
description: Perform a dry run (run everything except push)
21+
required: true
22+
default: false
23+
type: boolean
1924

2025
env:
2126
TZ: /usr/share/zoneinfo/America/Los_Angeles
@@ -246,16 +251,16 @@ jobs:
246251
git status -u
247252
- name: Commit changes to branch
248253
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 }}"
253257
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
259264

260265
commit_fbsource_artifacts:
261266
needs: download_artifacts
@@ -413,13 +418,13 @@ jobs:
413418
git status
414419
- name: Commit changes to branch
415420
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) }}
420426
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

0 commit comments

Comments
 (0)