Skip to content

Commit 2605e09

Browse files
committed
CCM-11726 Add run ID to trigger and filter
1 parent a62a13a commit 2605e09

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

.github/workflows/dispatch_internal_repo_workflow.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
--arg targetAccountGroup ${{ inputs.targetAccountGroup }} \
6666
--arg targetComponent ${{ inputs.targetComponent }} \
6767
--arg terraformAction "${{ inputs.terraformAction }}" \
68+
--arg callerRunId "${GITHUB_RUN_ID}" \
6869
'{
6970
"ref": "${{ inputs.internalRef }}",
7071
"inputs": (
@@ -74,7 +75,8 @@ jobs:
7475
"releaseVersion": $releaseVersion,
7576
"targetEnvironment": $targetEnvironment,
7677
"targetAccountGroup": $targetAccountGroup,
77-
"targetComponent": $targetComponent
78+
"targetComponent": $targetComponent,
79+
"callerRunId": $callerRunId
7880
}
7981
)
8082
}')
@@ -93,16 +95,20 @@ jobs:
9395
echo "Workflow triggered. Waiting for the workflow to complete.."
9496
9597
# Poll GitHub API to check the workflow status
98+
callerRunId="${GITHUB_RUN_ID}"
99+
96100
workflow_run_url=""
97-
for i in {1..12}; do
101+
for i in {1..18}; do
98102
workflow_run_url=$(curl -s \
99103
-H "Accept: application/vnd.github+json" \
100104
-H "Authorization: Bearer ${{ secrets.PR_TRIGGER_PAT }}" \
101105
-H "X-GitHub-Api-Version: 2022-11-28" \
102-
"https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/runs?event=workflow_dispatch&status=in_progress" \
103-
| jq -r '.workflow_runs[]
106+
"https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/runs?event=workflow_dispatch" \
107+
| jq -r --arg callerRunId "$callerRunId" \
108+
'.workflow_runs[]
104109
| select(.name
105-
| contains("'${{ inputs.targetEnvironment }}'") and
110+
| contains("caller:" + $callerRunId) and
111+
contains("'${{ inputs.targetEnvironment }}'") and
106112
contains("'${{ inputs.targetAccountGroup }}'") and
107113
contains("'${{ inputs.targetComponent }}'") and
108114
contains("'${{ inputs.terraformAction }}'"))

0 commit comments

Comments
 (0)