Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
b81050d
[maven-release-plugin] prepare for next development iteration
netty-project-bot Oct 14, 2025
46bb270
Re-enable reflective field accesses in native images (#15774)
zakkak Oct 21, 2025
fdf619e
Update JDK versions to latest release (#15789) (#15791)
normanmaurer Oct 27, 2025
57ec332
Handle invalid content length in continue request (#15794)
yawkat Oct 27, 2025
9dea622
Add a zero-delay option to AbstractReferenceCountedByteBufBenchmark (…
chrisvest Oct 28, 2025
2afb0ff
Correct HTTP/2 padding length check (#15793) (#15795)
normanmaurer Oct 28, 2025
dfbaa9c
Bump BlockHound version to 1.0.15.RELEASE (#15802)
violetagg Oct 28, 2025
220a5b1
Add 32k and 64k size classes to adaptive allocator (#15799) (#15800)
normanmaurer Oct 28, 2025
8711660
IndexOutOfBoundsException when running mqtt tests on java 25 #15804 (…
normanmaurer Nov 3, 2025
5dc8bcc
Fix reentrancy bug in ByteToMessageDecoder (#15834)
chrisvest Nov 12, 2025
cbfe223
Fix SizeClasses comment (#15841)
chrisvest Nov 13, 2025
3d0a713
Make big endian ASCII hashcode consistent with little endian (#15846)
chrisvest Nov 13, 2025
07c892d
Upgrade all macOS Intel workflow runners to macOS 15 (#15840)
chrisvest Nov 13, 2025
0bd93a2
chore: Update javadoc of CompositeByteBuf#releaes method (#15864)
He-Pin Nov 17, 2025
d01673a
Use real, instead of synthetic, HTTP/2 stream id (#15842)
chrisvest Nov 18, 2025
f97a55c
Fix flaky tests in codec-http module (#15862) (#15892)
normanmaurer Nov 19, 2025
416540a
Fix ZstdEncoder not producing data when source is smaller than block …
normanmaurer Nov 19, 2025
4647500
Fix Zstd compression for large data (#15861) (#15900)
normanmaurer Nov 19, 2025
c9306ab
Mark AbstractEpollStreamChannel.spliceTo(...) methods as deprecated (…
normanmaurer Nov 21, 2025
b5431a0
Use ServerBootstrap to bootstrap EpollServerSocketChannel (#15912) (#…
normanmaurer Nov 21, 2025
737a60e
Fix race condition in NonStickyEventExecutorGroup causing incorrect i…
danfaer Nov 26, 2025
ca6647a
Update lz4-java dependency with new group ID (#15940) (#15943)
normanmaurer Nov 29, 2025
73620cb
LocalChannel: Don't fire exception throught pipeline on connect failu…
normanmaurer Dec 2, 2025
1307e76
Socket: Fix handling of abstract namespaces on linux when creating th…
normanmaurer Dec 3, 2025
0d215df
SctpServerChannelConfig must support ChannelOption.SO_BACKLOG (#15965)
normanmaurer Dec 3, 2025
11346d6
Discard the following HttpContent for preflight request (#15941) (#15…
normanmaurer Dec 3, 2025
ad85492
Close Channel and fail bootstrap when setting a ChannelOption causes …
normanmaurer Dec 4, 2025
1f4ba6b
Pcap: Fix possible buffer leak when initializion fails (#15977)
normanmaurer Dec 4, 2025
cf6965b
Use exact length when allocating the acceptedAddress byte[] (#15973) …
normanmaurer Dec 8, 2025
42d458a
Update lz4-java version to 1.10.1 (#15978) (#15981)
normanmaurer Dec 8, 2025
9896970
Fix Socket reading of abstract unix domain addresses (#16010) (#16012)
normanmaurer Dec 11, 2025
77e81f1
Merge commit from fork
chrisvest Dec 11, 2025
c4a6d19
Fix tests to compile with older JDK versions
normanmaurer Dec 11, 2025
1729bf3
[maven-release-plugin] prepare release netty-4.1.129.Final
netty-project-bot Dec 11, 2025
f9d2cc6
[maven-release-plugin] prepare for next development iteration
netty-project-bot Dec 11, 2025
157f34f
Build fixes to allow using the epoll native transport on Android (#16…
normanmaurer Dec 12, 2025
66ec8d6
Fix MpscIntQueue bug (#16023) (#16027)
normanmaurer Dec 13, 2025
d3aa24b
LocalChannel: Reduce GC by re-using same Runnable (#16014) (#16028)
normanmaurer Dec 13, 2025
56328f9
Fix HTTP startline validation (#16022) (#16024)
normanmaurer Dec 13, 2025
54ba03e
Optimize HTTP startline validation (#16030) (#16042)
normanmaurer Dec 15, 2025
41ff1eb
[maven-release-plugin] prepare release netty-4.1.130.Final
netty-project-bot Dec 15, 2025
61572d5
[maven-release-plugin] prepare for next development iteration
netty-project-bot Dec 15, 2025
b24873c
NioDatagramChannel.block(...) does not early return on failure (#1604…
normanmaurer Dec 16, 2025
a08fecf
ChannelPipeline: Add tests for using ChannelHandlerContext and trigge…
normanmaurer Dec 18, 2025
0bb5674
Improve exception message generated by `EnhancingX509ExtendedTrustMan…
idelpivnitskiy Jan 7, 2026
2cdc7b1
Support for AWS Libcrypto (AWS-LC) netty-tcnative build (#15430) (#16…
geedo0 Jan 8, 2026
0cbc8fb
feat(netty-codec-http): more standard http content types (#16036) (#1…
normanmaurer Jan 9, 2026
e0aa2ab
codec-dns: Decompress MX RDATA exchange domain names during DNS recor…
normanmaurer Jan 12, 2026
9a98153
Buddy allocation for large buffers in adaptive allocator (#16053) (#1…
chrisvest Jan 13, 2026
f905908
Bump BlockHound version to 1.0.16.RELEASE (#16134) (#16136)
normanmaurer Jan 15, 2026
f80b70c
Await termination of SslHandler executor (#16138) (#16140)
normanmaurer Jan 15, 2026
169f636
SslHandler: Only resume on EventLoop if EventLoop is not shutting dow…
normanmaurer Jan 17, 2026
2dee9b6
Fix leak in OpenSslPrivateKeyMethodTest (#16145) (#16147)
normanmaurer Jan 17, 2026
496f55c
Wrap ECONNREFUSED in PortUnreachableException for UDP (#16131) (#16150)
normanmaurer Jan 18, 2026
0ff9677
Improve exception message when first HTTP2SettingsFrame has the ack f…
normanmaurer Jan 20, 2026
c6feb18
Bump com.ning:compress-lzf (4.1) (#16159)
yawkat Jan 22, 2026
073d736
SSL: Ensure used cipher in test can be used by any Java version (#161…
normanmaurer Jan 27, 2026
dd6c9c5
Update JDK versions to latest patch releases (#16184) (#16189)
normanmaurer Jan 28, 2026
3889433
Fix adaptive allocator bug from not noticing failed allocation (#1620…
chrisvest Jan 30, 2026
0676782
Avoid loosing original read exception (#16199) (#16204)
chrisvest Jan 31, 2026
5ddf9a1
Update some dependencies (#16198)
chrisvest Feb 2, 2026
ec24754
Backport multiple adaptive allocator changes (#16219)
chrisvest Feb 3, 2026
7195382
Update to netty-tcnative 2.0.75.Final (#16228)
normanmaurer Feb 4, 2026
615fbdb
[maven-release-plugin] prepare release netty-4.1.131.Final
netty-project-bot Feb 5, 2026
99c7f52
[maven-release-plugin] prepare for next development iteration
netty-project-bot Feb 5, 2026
d22b216
Fix Incorrect nanos-to-millis conversion in epoll_wait EINTR retry lo…
normanmaurer Feb 10, 2026
3e627ea
Make RefCntOpenSslContext.deallocate more robust (#16253) (#16257)
normanmaurer Feb 11, 2026
c999342
Update to gcc for arm 10.3-2021.07 (#16255) (#16263)
normanmaurer Feb 12, 2026
2387f32
HTTP2: Correctly account for padding when decompress (#16265)
normanmaurer Feb 13, 2026
2f79500
Update JDK versions to latest patch releases (#16254) (#16267)
normanmaurer Feb 13, 2026
a80f333
Backport 4.1: Automatic backporting workflow from 4.1 to 4.2 (#16274)
github-actions[bot] Feb 13, 2026
b80ae68
Backport 4.1: Backport PRs must be created with personal access token…
chrisvest Feb 16, 2026
7555645
Backport 4.1: Add more porting workflows (#16284)
netty-project-bot Feb 17, 2026
1e25fdc
Backport 4.1: Some polishing of the porting workflows (#16292)
netty-project-bot Feb 18, 2026
1e22fc4
Backport 4.1: Fix high-order bit aliasing in HttpUtil.validateToken (…
netty-project-bot Feb 19, 2026
8051d03
Auto-port 4.1: Support more branch freedom for auto-porting (#16310)
netty-project-bot Feb 20, 2026
78c6bf3
fix: the precedence of + is higher than >> (#16312) (#16316)
chrisvest Feb 21, 2026
27a66a4
AdaptiveByteBufAllocator: make sure byteBuf.capacity() not greater th…
chrisvest Feb 21, 2026
a66d7d3
Auto-port 4.1: Fix flaky PooledByteBufAllocatorTest (#16324)
netty-project-bot Feb 21, 2026
34edc9b
Auto-port 4.1: Fix pooled arena accounting tests (#16326)
netty-project-bot Feb 21, 2026
224a3e0
Auto-port 4.1: Fix RunInFastThreadLocalThreadExtension (#16328)
netty-project-bot Feb 21, 2026
da36b8d
Auto-port 4.1: AdaptivePoolingAllocator: call `unreserveMatchingBuddy…
netty-project-bot Feb 21, 2026
2c2e9b7
Auto-port 4.1: Mark LoggingHandlerTest with @Isolated to fix flaky bu…
netty-project-bot Feb 23, 2026
590aef2
Auto-port 4.1: Fix flaky HTTP/2 test (#16348)
netty-project-bot Feb 25, 2026
5ab66cb
Auto-port 4.1: Fix flaky RenegotiateTest (#16355)
netty-project-bot Feb 25, 2026
eda631f
Auto-port 4.1: Fix HTTP/2 push frame test (#16353)
netty-project-bot Feb 25, 2026
4d1a24a
SSL test: Don't depend on property value in test (#16346) (#16362)
normanmaurer Feb 26, 2026
ccf03c4
Auto-port 4.1: Don't assume CertificateFactory is thread-safe (#16364)
netty-project-bot Feb 26, 2026
4f46db0
AdaptivePoolingAllocator: assign a more explicit value to BuddyChunk.…
chrisvest Feb 26, 2026
d1dde14
Auto-port 4.1: Add more diagnostic points to PooledByteBufAllocatorTe…
netty-project-bot Feb 26, 2026
5c45828
Fix leak in SniHandlerTest (#16367) (#16377)
normanmaurer Feb 26, 2026
b1e08c5
Auto-port 4.1: Stabilize AbstractByteBufTest.testBytesInArrayMultiple…
netty-project-bot Feb 26, 2026
ebb66f9
Remove reference counting from size classed chunks (#16306) (#16379)
chrisvest Feb 26, 2026
09bf976
Auto-port 4.1: Stabilize AbstractByteBufTest.testToStringMultipleThre…
netty-project-bot Feb 27, 2026
442a8cf
Fix HttpObjectAggregator leaving connection stuck after 413 with AUTO…
samlandfried Mar 3, 2026
91e3dfd
Auto-port 4.1: Fix autoport fetching into the existing branch - again…
netty-project-bot Mar 5, 2026
0e416db
Auto-port 4.1: Capture why threads get stuck in testCopyMultipleThrea…
netty-project-bot Mar 6, 2026
99ea264
Auto-port 4.1: Remove unnecessary array access in DefaultAttributeMap…
netty-project-bot Mar 6, 2026
37656b2
Auto-port 4.1: Whitelist JMH annotation processing in microbench modu…
netty-project-bot Mar 9, 2026
41209d3
Auto-port 4.1: HTTP2: Ensure preface is flushed in all cases (#16432)
netty-project-bot Mar 11, 2026
2c096a0
Auto-port 4.1: Fix UnsupportedOperationException in readTrailingHeade…
netty-project-bot Mar 12, 2026
3c6be7e
Auto-port 4.1: Fix client_max_window_bits parameter handling in perme…
netty-project-bot Mar 12, 2026
7df743f
Auto-port 4.1: Native transports: Fix possible fd leak when fcntl fai…
netty-project-bot Mar 13, 2026
2fd4d28
Auto-port 4.1: Kqueue: Fix undefined behaviour when GetStringUTFChars…
netty-project-bot Mar 13, 2026
7d187ae
Auto-port 4.1: Kqueue: Possible overflow when using netty_kqueue_bsds…
netty-project-bot Mar 13, 2026
cbd7bb4
Auto-port 4.1: Native transports: Fix undefined behaviour when GetStr…
netty-project-bot Mar 13, 2026
19935c3
Auto-port 4.1: Epoll: Add null checks for safety reasons (#16463)
netty-project-bot Mar 13, 2026
56d84e1
Auto-port 4.1: DnsNameResolver: Skip test if we can not bind TCP and …
netty-project-bot Mar 14, 2026
779fce7
Auto-port 4.1: Epoll: Use correct value to initialize mmsghdr.msg_nam…
netty-project-bot Mar 16, 2026
5a0072b
Auto-port 4.1: Epoll: Fix support for IP_RECVORIGDSTADDR (#16468)
netty-project-bot Mar 16, 2026
3ac3f37
Auto-port 4.1: AdaptivePoolingAllocator: remove `ensureAccessible()` …
netty-project-bot Mar 16, 2026
692ec87
Auto-port 4.1: AdaptivePoolingAllocator: Fix assertion for size class…
netty-project-bot Mar 17, 2026
df65997
Epoll: setTcpMg5Sig(...) might overflow (#16511) (#16520)
normanmaurer Mar 18, 2026
10c1603
Auto-port 4.1: JdkZlibDecoder: accumulate decompressed output before …
netty-project-bot Mar 24, 2026
9f47a7b
Limit the number of Continuation frames per HTTP2 Headers (#13969)
normanmaurer Mar 24, 2026
60e53c9
Stricter HTTP/1.1 chunk extension parsing (#16537)
chrisvest Mar 24, 2026
ec119d4
[maven-release-plugin] prepare release netty-4.1.132.Final
netty-project-bot Mar 24, 2026
f22f5ae
Merge tag 'netty-4.1.132.Final' into dse-netty-4.1.132
tiagomlalves Mar 30, 2026
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
130 changes: 130 additions & 0 deletions .github/workflows/autoport-41.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Auto-port to 4.1
on:
pull_request_target:
types:
- closed
- labeled
branches:
- '4.2'
- '5.0'

jobs:
autoport:
name: "Auto-porting to 4.1"
concurrency:
group: port-41-${{ github.event.pull_request.number }}
cancel-in-progress: true
if: github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'needs-cherry-pick-4.1')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_PEM }}
ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
fetch-depth: '0' # Cherry-pick needs full history

- name: Setup git configuration
run: |
git config --global user.email "netty-project-bot@users.noreply.github.com"
git config --global user.name "Netty Project Bot"

- name: Create auto-port PR branch and cherry-pick
id: cherry-pick
run: |
MERGE_COMMIT="${{ github.event.pull_request.merge_commit_sha }}"
echo "Auto-porting commit: $MERGE_COMMIT"

PORT_BRANCH="auto-port-pr-${{ github.event.pull_request.number }}-to-4.1"
if [[ $(git branch --show-current) != '4.1' ]]; then
git fetch origin 4.1:4.1
fi
git checkout -b "$PORT_BRANCH" 4.1

if git cherry-pick -x "$MERGE_COMMIT"; then
echo "Cherry-pick successful"
else
echo "Cherry-pick failed - conflicts detected"
git cherry-pick --abort
exit 1
fi
echo "branch=$PORT_BRANCH" >> "$GITHUB_OUTPUT"

- name: Push auto-port branch
id: push
if: steps.cherry-pick.outcome == 'success'
run: |
if ! git push origin "${{ steps.cherry-pick.outputs.branch }}"; then
echo "Auto-port branch push failed"
exit 1
fi

- name: Create pull request
id: create-pr
if: steps.cherry-pick.outcome == 'success'
uses: actions/github-script@v8
with:
github-token: '${{ secrets.PAT_TOKEN_READ_WRITE_PR }}'
script: |
const { data: pr } = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Auto-port 4.1: ${context.payload.pull_request.title}`,
head: '${{ steps.cherry-pick.outputs.branch }}',
base: '4.1',
body: `Auto-port of #${context.payload.pull_request.number} to 4.1\n` +
`Cherry-picked commit: ${context.payload.pull_request.merge_commit_sha}\n\n---\n` +
`${context.payload.pull_request.body || ''}`
});
console.log(`Created auto-port PR: ${pr.html_url}`);
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `Auto-port PR for 4.1: #${pr.number}`
});

# Important: This script MUST run with the default GITHUB_TOKEN to avoid triggering other actions.
- name: Remove triggering label
if: steps.create-pr.outcome == 'success'
uses: actions/github-script@v8
with:
script: |
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
name: 'needs-cherry-pick-4.1'
});

- name: Report cherry-pick conflicts
if: failure() && steps.cherry-pick.outcome == 'failure'
uses: actions/github-script@v8
with:
github-token: '${{ secrets.PAT_TOKEN_READ_WRITE_PR }}'
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `Could not create auto-port PR.\nGot conflicts when cherry-picking onto 4.1.`
});

- name: Report auto-port branch push failure
if: failure() && steps.push.outcome == 'failure'
uses: actions/github-script@v8
with:
github-token: '${{ secrets.PAT_TOKEN_READ_WRITE_PR }}'
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `Could not create auto-port PR.\n`+
`I could cherry-pick onto 4.1 just fine, but pushing the new branch failed.`
});

- name: Remove branch on PR create failure
if: failure() && steps.cherry-pick.outputs.branch
run: |
git push -d origin "${{ steps.cherry-pick.outputs.branch }}"
130 changes: 130 additions & 0 deletions .github/workflows/autoport-42.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Auto-port to 4.2
on:
pull_request_target:
types:
- closed
- labeled
branches:
- '4.1'
- '5.0'

jobs:
autoport:
name: "Auto-porting to 4.2"
concurrency:
group: port-42-${{ github.event.pull_request.number }}
cancel-in-progress: true
if: github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'needs-cherry-pick-4.2')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_PEM }}
ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
fetch-depth: '0' # Cherry-pick needs full history

- name: Setup git configuration
run: |
git config --global user.email "netty-project-bot@users.noreply.github.com"
git config --global user.name "Netty Project Bot"

- name: Create auto-port PR branch and cherry-pick
id: cherry-pick
run: |
MERGE_COMMIT="${{ github.event.pull_request.merge_commit_sha }}"
echo "Auto-porting commit: $MERGE_COMMIT"

PORT_BRANCH="auto-port-pr-${{ github.event.pull_request.number }}-to-4.2"
if [[ $(git branch --show-current) != '4.2' ]]; then
git fetch origin 4.2:4.2
fi
git checkout -b "$PORT_BRANCH" 4.2

if git cherry-pick -x "$MERGE_COMMIT"; then
echo "Cherry-pick successful"
else
echo "Cherry-pick failed - conflicts detected"
git cherry-pick --abort
exit 1
fi
echo "branch=$PORT_BRANCH" >> "$GITHUB_OUTPUT"

- name: Push auto-port branch
id: push
if: steps.cherry-pick.outcome == 'success'
run: |
if ! git push origin "${{ steps.cherry-pick.outputs.branch }}"; then
echo "Auto-port branch push failed"
exit 1
fi

- name: Create pull request
id: create-pr
if: steps.cherry-pick.outcome == 'success'
uses: actions/github-script@v8
with:
github-token: '${{ secrets.PAT_TOKEN_READ_WRITE_PR }}'
script: |
const { data: pr } = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Auto-port 4.2: ${context.payload.pull_request.title}`,
head: '${{ steps.cherry-pick.outputs.branch }}',
base: '4.2',
body: `Auto-port of #${context.payload.pull_request.number} to 4.2\n` +
`Cherry-picked commit: ${context.payload.pull_request.merge_commit_sha}\n\n---\n` +
`${context.payload.pull_request.body || ''}`
});
console.log(`Created auto-port PR: ${pr.html_url}`);
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `Auto-port PR for 4.2: #${pr.number}`
});

# Important: This script MUST run with the default GITHUB_TOKEN to avoid triggering other actions.
- name: Remove triggering label
if: steps.create-pr.outcome == 'success'
uses: actions/github-script@v8
with:
script: |
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
name: 'needs-cherry-pick-4.2'
});

- name: Report cherry-pick conflicts
if: failure() && steps.cherry-pick.outcome == 'failure'
uses: actions/github-script@v8
with:
github-token: '${{ secrets.PAT_TOKEN_READ_WRITE_PR }}'
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `Could not create auto-port PR.\nGot conflicts when cherry-picking onto 4.2.`
});

- name: Report auto-port branch push failure
if: failure() && steps.push.outcome == 'failure'
uses: actions/github-script@v8
with:
github-token: '${{ secrets.PAT_TOKEN_READ_WRITE_PR }}'
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `Could not create auto-port PR.\n`+
`I could cherry-pick onto 4.2 just fine, but pushing the new branch failed.`
});

- name: Remove branch on PR create failure
if: failure() && steps.cherry-pick.outputs.branch
run: |
git push -d origin "${{ steps.cherry-pick.outputs.branch }}"
130 changes: 130 additions & 0 deletions .github/workflows/autoport-50.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Auto-port to 5.0
on:
pull_request_target:
types:
- closed
- labeled
branches:
- '4.1'
- '4.2'

jobs:
autoport:
name: "Auto-porting to 5.0"
concurrency:
group: port-50-${{ github.event.pull_request.number }}
cancel-in-progress: true
if: github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'needs-cherry-pick-5.0')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_PEM }}
ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
fetch-depth: '0' # Cherry-pick needs full history

- name: Setup git configuration
run: |
git config --global user.email "netty-project-bot@users.noreply.github.com"
git config --global user.name "Netty Project Bot"

- name: Create auto-port PR branch and cherry-pick
id: cherry-pick
run: |
MERGE_COMMIT="${{ github.event.pull_request.merge_commit_sha }}"
echo "Auto-porting commit: $MERGE_COMMIT"

PORT_BRANCH="auto-port-pr-${{ github.event.pull_request.number }}-to-5.0"
if [[ $(git branch --show-current) != '5.0' ]]; then
git fetch origin 5.0:5.0
fi
git checkout -b "$PORT_BRANCH" 5.0

if git cherry-pick -x "$MERGE_COMMIT"; then
echo "Cherry-pick successful"
else
echo "Cherry-pick failed - conflicts detected"
git cherry-pick --abort
exit 1
fi
echo "branch=$PORT_BRANCH" >> "$GITHUB_OUTPUT"

- name: Push auto-port branch
id: push
if: steps.cherry-pick.outcome == 'success'
run: |
if ! git push origin "${{ steps.cherry-pick.outputs.branch }}"; then
echo "Auto-port branch push failed"
exit 1
fi

- name: Create pull request
id: create-pr
if: steps.cherry-pick.outcome == 'success'
uses: actions/github-script@v8
with:
github-token: '${{ secrets.PAT_TOKEN_READ_WRITE_PR }}'
script: |
const { data: pr } = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Auto-port 5.0: ${context.payload.pull_request.title}`,
head: '${{ steps.cherry-pick.outputs.branch }}',
base: '5.0',
body: `Auto-port of #${context.payload.pull_request.number} to 5.0\n` +
`Cherry-picked commit: ${context.payload.pull_request.merge_commit_sha}\n\n---\n` +
`${context.payload.pull_request.body || ''}`
});
console.log(`Created auto-port PR: ${pr.html_url}`);
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `Auto-port PR for 5.0: #${pr.number}`
});

# Important: This script MUST run with the default GITHUB_TOKEN to avoid triggering other actions.
- name: Remove triggering label
if: steps.create-pr.outcome == 'success'
uses: actions/github-script@v8
with:
script: |
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
name: 'needs-cherry-pick-5.0'
});

- name: Report cherry-pick conflicts
if: failure() && steps.cherry-pick.outcome == 'failure'
uses: actions/github-script@v8
with:
github-token: '${{ secrets.PAT_TOKEN_READ_WRITE_PR }}'
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `Could not create auto-port PR.\nGot conflicts when cherry-picking onto 5.0.`
});

- name: Report auto-port branch push failure
if: failure() && steps.push.outcome == 'failure'
uses: actions/github-script@v8
with:
github-token: '${{ secrets.PAT_TOKEN_READ_WRITE_PR }}'
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `Could not create auto-port PR.\n`+
`I could cherry-pick onto 5.0 just fine, but pushing the new branch failed.`
});

- name: Remove branch on PR create failure
if: failure() && steps.cherry-pick.outputs.branch
run: |
git push -d origin "${{ steps.cherry-pick.outputs.branch }}"
Loading