add parameter for custom gitea user
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
OCram85 2022-07-13 16:08:38 +02:00
parent 96ae140414
commit 9b21febd7e
Signed by: OCram85
GPG Key ID: 456940F03DE016E1

View File

@ -29,7 +29,12 @@ function Send-PRComment {
param ( param (
[Parameter(Mandatory = $false, HelpMessage = 'HelpMessage')] [Parameter(Mandatory = $false, HelpMessage = 'HelpMessage')]
[ValidateSet('Add', 'Edit', 'Renew')] [ValidateSet('Add', 'Edit', 'Renew')]
[string]$Mode = 'Renew' [string]$Mode = 'Renew',
[Parameter(Mandatory = $false, HelpMessage = 'Gitea user for drone bot')]
[ValidateNotNullOrEmpty()]
[string]$GiteaUser= 'drone-bot'
) )
begin { begin {
@ -89,7 +94,7 @@ function Send-PRComment {
if ($Mode -eq 'Renew') { if ($Mode -eq 'Renew') {
$Comments = Invoke-RestMethod -Method 'Get' -Headers $APIHeaders -Uri $CommentAPICall $Comments = Invoke-RestMethod -Method 'Get' -Headers $APIHeaders -Uri $CommentAPICall
$DroneComments = $Comments | Where-Object { $DroneComments = $Comments | Where-Object {
$_.user.login -eq 'drone' $_.user.login -eq $GiteaUser
} | Select-Object -ExpandProperty 'id' } | Select-Object -ExpandProperty 'id'
Write-Debug -Message ('Found Drone comments: {0}.' -f ($DroneComments -join ', ')) Write-Debug -Message ('Found Drone comments: {0}.' -f ($DroneComments -join ', '))
foreach ($id in $DroneComments) { foreach ($id in $DroneComments) {