From 25c1fea649a1eb16f6ca2594dcf81f1fbef50197 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Fri, 25 Mar 2022 12:05:53 -0300 Subject: [PATCH] Changes to the GitHub action: - `config` is now optional - added `targets` to specify what we want to generate --- action.yml | 8 +++++++- entrypoint.sh | 23 +++++++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index af84fe41..76971b09 100644 --- a/action.yml +++ b/action.yml @@ -4,7 +4,8 @@ author: 'Salvador E. Tropea' inputs: config: description: 'The plotting config file to use' - required: true + required: false + default: '__SCAN__' dir: description: 'The output directory [default: .]' required: false @@ -21,6 +22,10 @@ inputs: description: 'Skip preflights, comma separated or "all" [default: no skip]' required: false default: '__NONE__' + targets: + description: 'List of targets to generate separated by spaces. To only run preflights use __NONE__ [default: generate all]' + required: false + default: '__ALL__' variant: description: 'Global variant to use [default: no variants]' required: false @@ -38,6 +43,7 @@ runs: - -b ${{ inputs.board }} - -e ${{ inputs.schema }} - -s ${{ inputs.skip }} + - -t ${{ inputs.targets }} - -v ${{ inputs.verbose }} - -V ${{ inputs.variant }} branding: diff --git a/entrypoint.sh b/entrypoint.sh index 402933e5..f7626674 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -13,6 +13,7 @@ SCHEMA="" SKIP="" DIR="" VARIANT="" +TARGETS="" # Exit error code EXIT_ERROR=1 @@ -44,6 +45,7 @@ function msg_help { echo -e " -b, --board FILE .kicad_pcb board file. Use __SCAN__ to get the first board file found in current folder." echo -e " -e, --schema FILE .sch schematic file. Use __SCAN__ to get the first schematic file found in current folder." echo -e " -s, --skip Skip preflights, comma separated or 'all'" + echo -e " -t, --targets List of targets to generate separated by spaces. To only run preflights use __NONE__." echo -e " -V, --variant Global variant" echo -e "\nMiscellaneous:" @@ -109,22 +111,35 @@ function args_process { do case "$1" in -c | --config ) shift - CONFIG="$1" + if [ "$1" == "__SCAN__" ]; then + CONFIG="" + else + CONFIG="-c $1" + fi ;; -b | --board ) shift if [ "$1" == "__SCAN__" ]; then - BOARD="-b "`ls -1 *.kicad_pcb | head -n1` + BOARD="" else BOARD="-b $1" fi ;; -e | --schematic ) shift if [ "$1" == "__SCAN__" ]; then - SCHEMA="-e "`ls -1 *.*sch | head -n1` + SCHEMA="" else SCHEMA="-e $1" fi ;; + -t | --targets ) shift + if [ "$1" == "__NONE__" ]; then + TARGETS="-i" + elif [ "$1" == "__ALL__" ]; then + TARGETS="" + else + TARGETS="$1" + fi + ;; -V | --variant ) shift if [ "$1" == "__NONE__" ]; then VARIANT="" @@ -176,7 +191,7 @@ function run { fi if [ -f $CONFIG ]; then - kibot -c $CONFIG $DIR $BOARD $SCHEMA $SKIP $VERBOSE $VARIANT + kibot -c $CONFIG $DIR $BOARD $SCHEMA $SKIP $VERBOSE $VARIANT $TARGETS else echo "config file '$CONFIG' not found!" exit $EXIT_ERROR