Skip to content

Commit 1d84468

Browse files
authored
Move between two repositories more cleanly during patch (#2172)
* fix: checkout multiple repos cleanly * fix: ensure git apply exits cleanly
1 parent 8afdec0 commit 1d84468

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.github/workflows/serverless-patch.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,21 @@ jobs:
3030
with:
3131
repository: elastic/elasticsearch-js
3232
ref: '${{ github.event.pull_request.merge_commit_sha }}'
33-
- name: Generate patch file
34-
run: |
35-
git format-patch -1 --stdout ${{ github.event.pull_request.merge_commit_sha }} > /tmp/patch.diff
33+
path: elasticsearch-js
3634
- uses: actions/checkout@v4
3735
with:
3836
repository: elastic/elasticsearch-serverless-js
3937
ref: main
40-
- name: Apply patch to serverless
38+
path: elasticsearch-serverless-js
39+
- name: Generate patch file
40+
run: |
41+
cd $GITHUB_WORKSPACE/elasticsearch-js
42+
git format-patch -1 --stdout ${{ github.event.pull_request.merge_commit_sha }} > /tmp/patch.diff
43+
- name: Apply patch file
4144
run: |
45+
cd $GITHUB_WORKSPACE/elasticsearch-serverless-js
4246
git checkout -b apply-patch-${{ github.event.pull_request.id }}
43-
git apply -C1 --recount --reject /tmp/patch.diff
47+
git apply -C1 --recount --reject /tmp/patch.diff || exit 0
4448
comment='Patch applied from elastic/elasticsearch-js#${{ github.event.pull_request.id }}'
4549
for f in $(find . -name '*.rej'); do
4650
comment="$comment\n\n## Rejected patch \`$f`\:\n\`\`\`\n$(cat $f)\n\`\`\`"

0 commit comments

Comments
 (0)