Skip to content

VIH-10361 Fix for unable to update judge last minute #366

VIH-10361 Fix for unable to update judge last minute

VIH-10361 Fix for unable to update judge last minute #366

Workflow file for this run

name: Close PR
on:
pull_request:
types:
- closed
permissions:
id-token: write
contents: read
env:
ado_org: 'hmcts'
ado_project: 'Video Hearings'
ado_pipeline: 'hmcts.vh-admin-web.sds.pr-close'
pr_number: ${{github.event.pull_request.number}}
branch: ${{ github.ref_name }}
AZURE_DEVOPS_EXT_PAT: ${{ secrets.AZURE_DEVOPS_TOKEN }}
jobs:
deployment:
runs-on: ubuntu-latest
steps:
- name: Trigger Pipline
shell: pwsh
run: |
$gitPullRequestId = "${{ env.pr_number }}"
$branch="${{ env.branch }}"
$pipelineName = "${{ env.ado_pipeline }}"
$organisation = "https://dev.azure.com/${{ env.ado_org }}/"
$project = "${{ env.ado_project }}"
Write-Host "Login to $organisation $project"
#az devops login --organization $organisation
Write-Host "Get Definition of $pipelineName"
$definitions = az pipelines build definition list --name $pipelineName --org $organisation --project $project | ConvertFrom-Json
$definitionId = ""
if ($definitions.length -gt 0){
$definition = $definitions[0]
Write-host $definition
$definitionId = $definition.id
Write-Host "Trigger PR $gitPullRequestId def $definitionId for branch $branch"
az pipelines run --branch $branch --detect $false --folder-path "\" --id $definitionId --org $organisation --project $project --parameters "prNumber=$gitPullRequestId" #--debug
} else {
Write-Error "No Definition found with name $pipelineName in $organisation proj $project "
exit 1
}