@@ -113,35 +113,23 @@ jobs:
113113 Deploy :
114114 needs : [ Build, Artefact-Version ]
115115 runs-on : ubuntu-latest
116+ if : github.event_name == 'push'
116117
117118 steps :
118- - name : Trigger ADO pipeline
119- env :
120- ADO_ORG : ' hmcts-cpp'
121- ADO_PROJECT : ' cpp-apps'
122- PIPELINE_ID : 460 # cp-gh-artifact-to-acr
123- ADO_PAT : ${{ secrets.HMCTS_ADO_PAT }}
124- ARTEFACT_VERSION : ${{ needs.Artefact-Version.outputs.artefact_version }}
119+ - name : Extract repo name
120+ id : extract_repo
125121 run : |
126- REPO_NAME="${GITHUB_REPOSITORY##*/}"
127- TARGET_REPOSITORY="${GITHUB_REPOSITORY}"
128-
129- curl -X POST \
130- -u ":${ADO_PAT}" \
131- -H "Content-Type: application/json" \
132- https://dev.azure.com/${ADO_ORG}/${ADO_PROJECT}/_apis/pipelines/${PIPELINE_ID}/runs?api-version=7.0 \
133- -d "{
134- \"resources\": {
135- \"repositories\": {
136- \"self\": {
137- \"refName\": \"refs/heads/main\"
138- }
139- }
140- },
141- \"templateParameters\": {
142- \"GROUP_ID\": \"uk.gov.hmcts.cp\",
143- \"ARTIFACT_ID\": \"${REPO_NAME}\",
144- \"ARTIFACT_VERSION\": \"${ARTEFACT_VERSION}\",
145- \"TARGET_REPOSITORY\": \"${TARGET_REPOSITORY}\"
146- }
147- }"
122+ echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
123+
124+ - name : Trigger ADO pipeline
125+ uses : hmcts/trigger-ado-pipeline@v1
126+ with :
127+ pipeline_id : 460 # cp-gh-artifact-to-acr
128+ ado_pat : ${{ secrets.HMCTS_ADO_PAT }}
129+ template_parameters : >
130+ {
131+ "GROUP_ID": "uk.gov.hmcts.cp",
132+ "ARTIFACT_ID": "${{ env.REPO_NAME }}",
133+ "ARTIFACT_VERSION": "${{ needs.Artefact-Version.outputs.artefact_version }}",
134+ "TARGET_REPOSITORY": "${{ github.repository }}"
135+ }
0 commit comments