{"action":"opened","issue":{"url":"https://api.github.com/repos/cake-build/resources/issues/11","repository_url":"https://api.github.com/repos/cake-build/resources","labels_url":"https://api.github.com/repos/cake-build/resources/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/cake-build/resources/issues/11/comments","events_url":"https://api.github.com/repos/cake-build/resources/issues/11/events","html_url":"https://github.com/cake-build/resources/issues/11","id":168290565,"number":11,"title":"Allow script parameters to be overridden by environment vars","user":{"login":"Philo","id":432217,"avatar_url":"https://avatars.githubusercontent.com/u/432217?v=3","gravatar_id":"","url":"https://api.github.com/users/Philo","html_url":"https://github.com/Philo","followers_url":"https://api.github.com/users/Philo/followers","following_url":"https://api.github.com/users/Philo/following{/other_user}","gists_url":"https://api.github.com/users/Philo/gists{/gist_id}","starred_url":"https://api.github.com/users/Philo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Philo/subscriptions","organizations_url":"https://api.github.com/users/Philo/orgs","repos_url":"https://api.github.com/users/Philo/repos","events_url":"https://api.github.com/users/Philo/events{/privacy}","received_events_url":"https://api.github.com/users/Philo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-29T09:54:43Z","updated_at":"2016-07-29T09:54:43Z","closed_at":null,"body":"I have a customised build.ps1 that allows certain script parameters to be overridden by environment variables, this is particularly useful for the ```-Verbosity``` parameter.\r\n\r\n```powershell\r\n[CmdletBinding()]\r\nParam(\r\n    [string]$Script = $(if (Test-Path env:/CAKE_SCRIPT) { \"$env:CAKE_SCRIPT\" } else { \"build.cake\" }),\r\n    [string]$Target = $(if (Test-Path env:/CAKE_TARGET) { \"$env:CAKE_TARGET\" } else { \"Default\" }),\r\n    [string]$Configuration = $(if (Test-Path env:/CONFIGURATION) { \"$env:CONFIGURATION\" } else { \"Release\" }),\r\n    [ValidateSet(\"Quiet\", \"Minimal\", \"Normal\", \"Verbose\", \"Diagnostic\")]\r\n    [string]$Verbosity = $(if (Test-Path env:/CAKE_VERBOSITY) { \"$env:CAKE_VERBOSITY\" } else { \"Verbose\" }),\r\n    [switch]$Experimental,\r\n    [Alias(\"DryRun\",\"Noop\")]\r\n    [switch]$WhatIf,\r\n    [switch]$Mono,\r\n    [switch]$SkipToolPackageRestore,\r\n    [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]\r\n    [string[]]$ScriptArgs\r\n)\r\n```\r\n\r\nI am by no means a \"powershell guy\" but thought that this sort of alteration would be beneficial to others.\r\n\r\n### Environment Variable Naming\r\n**CAKE_SCRIPT**, **CAKE_TARGET** and **CAKE_VERBOSITY** are named to prevent potential conflicts with other environment variables, while **CONFIGURATION** is specifically named this way as AppVeyor (maybe other CI servers) will set this to the build configuration."}}
{"actor":{"display_login":"Philo"}}