add parameter for custom gitea user
This commit is contained in:
parent
96ae140414
commit
9b21febd7e
@ -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) {
|
||||||
|
Reference in New Issue
Block a user