Skip to content

Commit 8dabbcb

Browse files
committed
Another approach.
1 parent c9b466c commit 8dabbcb

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/commit-built-file-changes.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
} );
7979
8080
const fs = require( 'fs' );
81-
fs.writeFileSync( '${{ github.workspace }}/artifacts/pr-built-file-changes.zip', Buffer.from( download.data ) )
81+
fs.writeFileSync( '${{ github.workspace }}/pr-built-file-changes.zip', Buffer.from( download.data ) )
8282
env:
8383
RUN_ID: ${{ github.event.workflow_run.id }}
8484

@@ -93,7 +93,7 @@ jobs:
9393
9494
- name: Unzip the artifact containing the PR data
9595
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
96-
run: unzip artifacts/pr-built-file-changes.zip
96+
run: unzip pr-built-file-changes.zip
9797

9898
- name: Generate Installation Token
9999
id: generate_token
@@ -140,6 +140,7 @@ jobs:
140140
with:
141141
repository: ${{ github.event.workflow_run.repository.full_name }}
142142
ref: ${{ github.event.workflow_run.head_branch }}
143+
path: 'pr-repo'
143144
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
144145
token: ${{ env.ACCESS_TOKEN }}
145146

@@ -148,27 +149,33 @@ jobs:
148149

149150
- name: Apply patch
150151
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
151-
run: git apply ./artifacts/changes.diff
152+
working-directory: 'pr-repo'
153+
run: git apply ${{ github.workspace }}/changes.diff
152154

153155
- name: Display changes to versioned files
154156
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
157+
working-directory: 'pr-repo'
155158
run: git diff
156159

157160
- name: Configure git user name and email
158161
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
162+
working-directory: 'pr-repo'
159163
run: |
160164
git config user.name "test-wp-build-script-commit[bot]"
161165
git config user.email ${{ env.GH_APP_ID }}+test-wp-build-script-commit[bot]@users.noreply.github.com
162166
163167
- name: Stage changes
164168
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
169+
working-directory: 'pr-repo'
165170
run: git add .
166171

167172
- name: Commit changes
168173
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
174+
working-directory: 'pr-repo'
169175
run: |
170176
git commit -m "Automation: Updating built files with changes. [dependabot skip]"
171177
172178
- name: Push changes
173179
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
180+
working-directory: 'pr-repo'
174181
run: git push

0 commit comments

Comments
 (0)