Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-use existing work in module AzurePipelinesPS #9

Open
johlju opened this issue Jun 11, 2022 · 2 comments
Open

Re-use existing work in module AzurePipelinesPS #9

johlju opened this issue Jun 11, 2022 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@johlju
Copy link
Collaborator

johlju commented Jun 11, 2022

There has been work in the PowerShell Gallery module AzurePipelinesPS that could help with the tasks in this module. Suggest we investigate if the below code can be replaced by the command New-APGitPullRequest.

Current code in task:

$payload = @{
sourceRefName = "refs/heads/$BranchName"
targetRefName = "refs/heads/$MainGitBranch"
title = $PullRequestConfigTitle -f $ModuleVersion
description = $PullRequestConfigDescription -f $ModuleVersion
completionOptions = @{
deleteSourceBranch = $true
}
}
$patBase64 = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(('{0}:{1}' -f 'PAT', $BasicAuthPAT)))
$uri = 'https://{0}/{1}/{2}/_apis/git/repositories/{3}/pullrequests?supportsIterations=false&api-version=6.0' -f @(
$PullRequestConfigInstance,
$PullRequestConfigCollection,
$PullRequestConfigProject,
$PullRequestConfigRepositoryID
)
$invokeRestMethodParameters = @{
Method = 'POST'
Uri = $uri
ContentType = 'application/json; charset=utf-8'
Headers = @{
AUTHORIZATION = 'basic {0}' -f $patBase64
}
Body = $payload | ConvertTo-Json
ErrorAction = 'Stop'
}
$result = Invoke-RestMethod @invokeRestMethodParameters
if ($PullRequestConfigDebug)
{
$result
}

@AZtino
Copy link

AZtino commented Apr 18, 2024

I would really appreciate that. It seems to me that this module would enable Windows authentication for build worker servers (on-prem). Which would also eliminate the need for the PAT.

AzurePipelinesPS Readme

@johlju
Copy link
Collaborator Author

johlju commented Apr 21, 2024

Happy to see a PR that re-uses the commands in the module.

@johlju johlju added enhancement New feature or request help wanted Extra attention is needed labels Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants