From 78532b17de0d7b35102ea10d2745b3f14113da97 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Tue, 8 Feb 2022 00:49:31 +0530 Subject: [PATCH] Fail when runner it set to github on self-hosted environments --- src/scripts/unix.sh | 5 +++++ src/scripts/win32.ps1 | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/scripts/unix.sh b/src/scripts/unix.sh index dc97bfb3..a6ee32c9 100644 --- a/src/scripts/unix.sh +++ b/src/scripts/unix.sh @@ -53,6 +53,11 @@ read_env() { fail_fast="${fail_fast:-${FAIL_FAST:-false}}" [[ -z "${ImageOS}" && -z "${ImageVersion}" ]] && _runner=self-hosted || _runner=github runner="${runner:-${RUNNER:-$_runner}}" + + if [[ "$runner" = "github" && $_runner = "self-hosted" ]]; then + fail_fast=true + add_log "$cross" "Runner" "Runner set as github in self-hosted environment" + fi } # Function to download a file using cURL. diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index a3c2365c..a074f03c 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -259,7 +259,11 @@ if ( $env:GITHUB_ACTIONS -eq 'true') { $env:END_GROUP = '' } -if($env:RUNNER -eq 'self-hosted' -or (-not($env:ImageOS) -and -not($env:ImageVersion))) { +if(-not($env:ImageOS) -and -not($env:ImageVersion)) { + if($env:RUNNER -eq 'github') { + Add-Log $cross "Runner" "Runner set as github in self-hosted environment" + exit 1 + } $bin_dir = 'C:\tools\bin' $php_dir = "$php_dir$version" $ext_dir = "$php_dir\ext"