Skip to content

Commit

Permalink
Enable workflow from pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
v-amolpatil committed Sep 8, 2023
1 parent e262391 commit e2ec36f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
35 changes: 34 additions & 1 deletion .azure-pipelines/callGithubWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,40 @@ jobs:
# NOT MAIN/MASTER OR AUTOMATED BRANCH
if ($branchName -ne 'master' -and $isAutoGeneratedPR -eq $false -and $targetBranch -eq 'master')
{
.script/package-automation/invokeGithubWorklow.ps1 $branchName $pullRequestNumber
# INVOKE GITHUB WORKFLOW
$header = @{
"Accept" = "application/vnd.github+json"
}
$githubToken = "$($env:GITHUB_TOKEN_VALUE)"
$token = $githubToken | ConvertTo-SecureString -AsPlainText -Force
$pullRequestNumberInt = [int]$pullRequestNumber
$client_payload = @{
"command" = "ping"
"pullRequestBranchName" = "$branchName"
"pullRequestNumber" = $pullRequestNumberInt
}
$BodyJson = @{
"event_type" = "package-command"
"client_payload" = $client_payload
}
$jsonBody = $BodyJson | ConvertTo-Json
Write-Host "jsonBody $jsonBody"
$Parameters = @{
Method = "POST"
Uri = "https://api.github.com/repos/Azure/Azure-Sentinel/dispatches"
Headers = $Header
ContentType = "application/json"
Body = $jsonBody
Authentication = "Bearer"
Token = $token
}
$result = Invoke-RestMethod @Parameters
Write-Host $result
}
else
{
Expand Down
34 changes: 0 additions & 34 deletions .script/package-automation/invokeGithubWorklow.ps1

This file was deleted.

0 comments on commit e2ec36f

Please sign in to comment.