Skip to content

Commit a44bbd6

Browse files
committed
[nrf noup] ci: Dynamically set target branch for manifest PRs
Dynamically set target branch for manifest PRs Signed-off-by: Jan Gałda <[email protected]>
1 parent fc695cb commit a44bbd6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/manifest-PR.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,35 @@ on:
44
types: [opened, synchronize, closed, reopened]
55
branches:
66
- main
7+
- ncs-v*-branch
78

89
permissions:
910
contents: read
1011

1112
jobs:
1213
call-manifest-pr-action:
1314
runs-on: ubuntu-latest
15+
outputs:
16+
base-branch: ${{ steps.set-base-branch.outputs.base_branch }}
1417
steps:
18+
# Determine the base branch:
19+
# * sdk-zephyr/main -> sdk-nrf/main
20+
# * sdk-zephyr/ncs-vX.Y-branch -> sdk-nrf/vX.Y-branch
21+
- name: Set base branch
22+
id: set-base-branch
23+
run: |
24+
if [[ "${{ github.event.pull_request.base.ref }}" == "main" ]]; then
25+
echo "base_branch=main" >> "$GITHUB_OUTPUT"
26+
elif [[ "${{ github.event.pull_request.base.ref }}" =~ ^ncs-(v[0-9]+\.[0-9]+-branch)$ ]]; then
27+
branch_name="${{ github.event.pull_request.base.ref }}"
28+
branch_name="${branch_name#ncs-}"
29+
echo "base_branch=${branch_name}" >> "$GITHUB_OUTPUT"
30+
else
31+
echo "Error: Unsupported base branch: ${{ github.event.pull_request.base.ref }}" >&2
32+
exit 1
1533
- name: handle manifest PR
1634
uses: nrfconnect/action-manifest-pr@main
1735
with:
1836
token: ${{ secrets.NCS_GITHUB_TOKEN }}
1937
manifest-pr-title-details: ${{ github.event.pull_request.title }}
38+
base-branch: ${{ steps.set-base-branch.outputs.base_branch }}

0 commit comments

Comments
 (0)