Skip to content

Commit 55b067c

Browse files
committed
label-target: 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-target workflow, which can be easily reusable by just passing target/subtarget inputs. References: openwrt/openwrt#16784 Signed-off-by: Petr Štetiar <ynezz@true.cz>
1 parent 7666701 commit 55b067c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.github/workflows/label-target.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
name: Build check target specified in labels
44
on:
55
workflow_call:
6+
inputs:
7+
target:
8+
type: string
9+
subtarget:
10+
type: string
611

712
jobs:
813
set_target:
@@ -19,8 +24,17 @@ jobs:
1924
env:
2025
CI_EVENT_LABEL_NAME: ${{ github.event.label.name }}
2126
run: |
22-
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT
23-
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT
27+
if [ -n "${{ inputs.target}}" ]; then
28+
echo "target=${{ inputs.target }}"
29+
else
30+
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target=\1/p'
31+
fi 2>&1 | tee --append $GITHUB_OUTPUT
32+
33+
if [ -n "${{ inputs.subtarget}}" ]; then
34+
echo "subtarget=${{ inputs.subtarget }}"
35+
else
36+
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget=\2/p'
37+
fi 2>&1 | tee --append $GITHUB_OUTPUT
2438
2539
build_target:
2640
name: Build target

0 commit comments

Comments
 (0)