Skip to content

Commit 5fd7d92

Browse files
committed
label-kernel: make it reusable
In some cases it might be handy to quickly smoke test certain types of changes, where it usually doesn't make sense to build everything, so lets allow that with reusable label-kernel workflow, which can be easily reusable by just passing target/subtarget/testing inputs. References: openwrt/openwrt#16784 Signed-off-by: Petr Štetiar <ynezz@true.cz>
1 parent 06f59d0 commit 5fd7d92

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

.github/workflows/label-kernel.yml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
name: Build kernel and check patches for target specified in labels
44
on:
55
workflow_call:
6+
inputs:
7+
target:
8+
type: string
9+
subtarget:
10+
type: string
11+
testing:
12+
type: boolean
613

714
jobs:
815
set_target:
9-
if: startsWith(github.event.label.name, 'ci:kernel:')
16+
if: startsWith(github.event.label.name, 'ci:kernel:') || inputs.target != ''
1017
name: Set target
1118
runs-on: ubuntu-latest
1219
outputs:
@@ -22,9 +29,30 @@ jobs:
2229
env:
2330
CI_EVENT_LABEL_NAME: ${{ github.event.label.name }}
2431
run: |
25-
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT
26-
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT
27-
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/testing=\3/p' | tee --append $GITHUB_OUTPUT
32+
if [ -n "${{ inputs.target}}" ]; then
33+
target="${{ inputs.target }}"
34+
else
35+
target=$(echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/\1/p')
36+
fi
37+
38+
if [ -n "${{ inputs.subtarget}}" ]; then
39+
subtarget="${{ inputs.subtarget }}"
40+
else
41+
subtarget=$(echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/\2/p')
42+
fi
43+
44+
if [ -n "${{ inputs.testing}}" ]; then
45+
testing="${{ inputs.testing }}"
46+
else
47+
testing=$(echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/\3/p')
48+
fi
49+
50+
echo "Setting target as $target, subtarget as $subtarget, testing as $testing"
51+
{
52+
echo "target=$target"
53+
echo "subtarget=$subtarget"
54+
echo "testing=$testing"
55+
} >> "$GITHUB_OUTPUT"
2856
2957
- name: Set targets
3058
id: set_target

0 commit comments

Comments
 (0)