Skip to content

Commit 7666701

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 3e033f2 commit 7666701

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

.github/workflows/label-kernel.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
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:
@@ -22,9 +29,23 @@ 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+
echo "target=${{ inputs.target }}"
34+
else
35+
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/target=\1/p'
36+
fi 2>&1 | tee --append $GITHUB_OUTPUT
37+
38+
if [ -n "${{ inputs.subtarget}}" ]; then
39+
echo "subtarget=${{ inputs.subtarget }}"
40+
else
41+
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/subtarget=\2/p'
42+
fi 2>&1 | tee --append $GITHUB_OUTPUT
43+
44+
if [ -n "${{ inputs.testing}}" ]; then
45+
echo "testing=${{ inputs.testing }}"
46+
else
47+
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/testing=\3/p'
48+
fi 2>&1 | tee --append $GITHUB_OUTPUT
2849
2950
- name: Set targets
3051
id: set_target

0 commit comments

Comments
 (0)