-
Notifications
You must be signed in to change notification settings - Fork 2
/
detectCodeRunPlatform.ps1
31 lines (31 loc) · 1014 Bytes
/
detectCodeRunPlatform.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
if ($env:GITHUB_SERVER_URL -and $env:CODESPACES) {
#GitHub Codespaces
$checkCodeRunPlatform = "GitHubCodespaces"
Write-Host "running on:" $checkCodeRunPlatform
}
elseif ($env:SYSTEM_TEAMPROJECTID -and $env:BUILD_REPOSITORY_ID) {
#Azure DevOps
$checkCodeRunPlatform = "AzureDevOps"
Write-Host "running on:" $checkCodeRunPlatform
}
elseif ($PSPrivateMetadata) {
#Azure Automation
$checkCodeRunPlatform = "AzureAutomation"
Write-Output "running on:" $checkCodeRunPlatform
}
elseif ($env:GITHUB_ACTIONS) {
#GitHub Actions
$checkCodeRunPlatform = "GitHubActions"
Write-Host "running on:" $checkCodeRunPlatform
}
elseif ($env:ACC_IDLE_TIME_LIMIT -and $env:AZURE_HTTP_USER_AGENT -and $env:AZUREPS_HOST_ENVIRONMENT) {
#Azure Cloud Shell
$checkCodeRunPlatform = "CloudShell"
Write-Host "running on:" $checkCodeRunPlatform
}
else {
#Other Console
$checkCodeRunPlatform = "Console"
Write-Host "running on:" $checkCodeRunPlatform
}
#todo? Azure Functions