Skip to content

Move between two repositories more cleanly during patch #2172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/serverless-patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,21 @@ jobs:
with:
repository: elastic/elasticsearch-js
ref: '${{ github.event.pull_request.merge_commit_sha }}'
- name: Generate patch file
run: |
git format-patch -1 --stdout ${{ github.event.pull_request.merge_commit_sha }} > /tmp/patch.diff
path: elasticsearch-js
- uses: actions/checkout@v4
with:
repository: elastic/elasticsearch-serverless-js
ref: main
- name: Apply patch to serverless
path: elasticsearch-serverless-js
- name: Generate patch file
run: |
cd $GITHUB_WORKSPACE/elasticsearch-js
git format-patch -1 --stdout ${{ github.event.pull_request.merge_commit_sha }} > /tmp/patch.diff
- name: Apply patch file
run: |
cd $GITHUB_WORKSPACE/elasticsearch-serverless-js
git checkout -b apply-patch-${{ github.event.pull_request.id }}
git apply -C1 --recount --reject /tmp/patch.diff
git apply -C1 --recount --reject /tmp/patch.diff || exit 0
comment='Patch applied from elastic/elasticsearch-js#${{ github.event.pull_request.id }}'
for f in $(find . -name '*.rej'); do
comment="$comment\n\n## Rejected patch \`$f`\:\n\`\`\`\n$(cat $f)\n\`\`\`"
Expand Down