From 3a4acaaed8bff21486c1e733bdf81fea378af654 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Wed, 12 Jan 2022 21:15:11 +0530 Subject: [PATCH] Default to self-hosted unless GitHub hosted runner is detected Refactor read_env in unix.sh --- src/scripts/unix.sh | 9 ++++----- src/scripts/win32.ps1 | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/scripts/unix.sh b/src/scripts/unix.sh index db74bbdb..206c8ef8 100644 --- a/src/scripts/unix.sh +++ b/src/scripts/unix.sh @@ -32,11 +32,10 @@ add_log() { # Function to read env inputs. read_env() { - [[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}" - [ "$update" = false ] && [[ -n ${UPDATE} ]] && update="${UPDATE}" - [[ -z "${runner}" ]] && runner='github' && RUNNER='github' || runner="${runner}" - [ "$runner" = false ] && [[ -n ${RUNNER} ]] && runner="${RUNNER}" - [[ -z "${fail_fast}" ]] && fail_fast='false' || fail_fast="${fail_fast}" + update="${update:-${UPDATE:-false}}" + fail_fast="${fail_fast:-${FAIL_FAST:-false}}" + [[ -z "${ImageOS}" && -z "${ImageVersion}" ]] && _runner=self-hosted || _runner=github + runner="${runner:-${RUNNER:-$_runner}}" } # Function to download a file using cURL. diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 7ae0ef42..da53fa6a 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -169,7 +169,7 @@ $ts = $env:PHPTS -eq 'ts' if($env:PHPTS -ne 'ts') { $env:PHPTS = 'nts' } -if($env:RUNNER -eq 'self-hosted') { +if($env:RUNNER -eq 'self-hosted' -or (-not($env:ImageOS) -and -not($env:ImageVersion))) { $bin_dir = 'C:\tools\bin' $php_dir = "$php_dir$version" $ext_dir = "$php_dir\ext"