init
This commit is contained in:
19
Create-PAT.ps1
Normal file
19
Create-PAT.ps1
Normal file
@@ -0,0 +1,19 @@
|
||||
$HostUrl = "https://code.wynenterprise.io"
|
||||
$UserName = "KodoBot"
|
||||
$Password = "<KodoBot password here>"
|
||||
$TokenName = "ci-token"
|
||||
|
||||
$pair = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("${UserName}:${Password}"))
|
||||
|
||||
$Headers = @{
|
||||
Authorization = "Basic $pair"
|
||||
"Content-Type" = "application/json"
|
||||
}
|
||||
|
||||
$Body = @{
|
||||
name = $TokenName
|
||||
scopes = @( "write:issue", "write:repository", "read:user" )
|
||||
} | ConvertTo-Json
|
||||
|
||||
$response = Invoke-RestMethod -Method Post -Uri "$HostUrl/api/v1/users/$UserName/tokens" -Headers $Headers -Body $Body
|
||||
$response.sha1
|
||||
Reference in New Issue
Block a user