Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. $moduleRootPath = Split-Path -Path $PSScriptRoot -Parent
  2. . (Join-Path -Path $moduleRootPath -ChildPath 'Tests\Config\Settings.ps1')
  3. Import-Module -Name (Join-Path -Path $moduleRootPath -ChildPath 'PowerShellForGitHub.psd1') -Force
  4.  
  5. if ([string]::IsNullOrEmpty($env:ciAccessToken))
  6. {
  7. $message = @(
  8. 'The tests are using the configuration settings defined in Tests\Config\Settings.ps1.',
  9. 'If you haven''t locally modified those values, your tests are going to fail since you',
  10. 'don''t have access to the default accounts referenced. If that is the case, you should',
  11. 'cancel the existing tests, modify the values to ones you have access to, call',
  12. 'Set-GitHubAuthentication to cache your AccessToken, and then try running the tests again.')
  13. Write-Warning -Message ($message -join [Environment]::NewLine)
  14. }
  15. else
  16. {
  17. $secureString = $env:ciAccessToken | ConvertTo-SecureString -AsPlainText -Force
  18. $cred = New-Object System.Management.Automation.PSCredential "<username is ignored>", $secureString
  19. Set-GitHubAuthentication -Credential $cred
  20.  
  21. $script:ownerName = $env:ciOwnerName
  22. $script:organizationName = $env:ciOrganizationName
  23.  
  24. Write-Warning -Message 'This run is being executed in the Azure Dev Ops environment.'
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement