File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ name : Apply PR changes to serverless
3
+ on :
4
+ pull_request_target :
5
+ types :
6
+ - closed
7
+ - labeled
8
+
9
+ jobs :
10
+ backport :
11
+ name : Backport
12
+ runs-on : ubuntu-latest
13
+ # Only react to merged PRs for security reasons.
14
+ # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
15
+ if : >
16
+ github.event.pull_request.merged
17
+ && (
18
+ (
19
+ github.event.action == 'closed'
20
+ && contains(github.event.pull_request.labels.*.name, 'apply-to-serverless')
21
+ )
22
+ ||
23
+ (
24
+ github.event.action == 'labeled'
25
+ && github.event.label.name == 'apply-to-serverless'
26
+ )
27
+ )
28
+ steps :
29
+ - uses : actions/checkout@v4
30
+ - name : Generate patch file
31
+ run : |
32
+ git format-patch -1 --stdout ${{ github.event.pull_request.merge_commit_sha }} > /tmp/patch.diff
33
+ - uses : actions/checkout@v4
34
+ with :
35
+ repository : elastic/elasticsearch-serverless-js
36
+ ref : main
37
+ - name : Apply patch to serverless
38
+ run : |
39
+ git checkout -b apply-patch-${{ github.event.pull_request.id }}
40
+ git apply -C1 --recount --reject /tmp/patch.diff
41
+ comment='Patch applied from elastic/elasticsearch-js#${{ github.event.pull_request.id }}'
42
+ for f in $(find . -name '*.rej'); do
43
+ comment="$comment\n\n## Rejected patch \`$f`\:\n\`\`\`\n$(cat $f)\n\`\`\`"
44
+ done
45
+ gh pr create -t "Apply PR changes from elastic/elasticsearch-js#${{ github.event.pull_request.id }}" --body "$comment"
You can’t perform that action at this time.
0 commit comments