Skip to content

Commit e4a7714

Browse files
committed
CCM-11726 Filter by caller run ID only on test workflows
1 parent 4b5e7b0 commit e4a7714

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/dispatch_internal_repo_workflow.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,19 @@ jobs:
107107
-H "X-GitHub-Api-Version: 2022-11-28" \
108108
"https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/runs?event=workflow_dispatch" \
109109
| jq -r --arg callerRunId "$callerRunId" \
110+
--arg targetWorkflow "${{ inputs.targetWorkflow }}" \
110111
'.workflow_runs[]
111-
| select(.name
112-
| contains("caller:" + $callerRunId) and
113-
contains("'${{ inputs.targetEnvironment }}'") and
114-
contains("'${{ inputs.targetAccountGroup }}'") and
115-
contains("'${{ inputs.targetComponent }}'") and
116-
contains("'${{ inputs.terraformAction }}'"))
117-
| select(.path == ".github/workflows/'${{ inputs.targetWorkflow }}'")
118-
| .url')
112+
| select(.path == ".github/workflows/" + $targetWorkflow)
113+
| select(.name
114+
| contains("'${{ inputs.targetEnvironment }}'") and
115+
contains("'${{ inputs.targetAccountGroup }}'") and
116+
contains("'${{ inputs.targetComponent }}'") and
117+
contains("'${{ inputs.terraformAction }}'"))
118+
| if ($targetWorkflow | test("dispatch-(acceptance|contextual|product|security)-tests-.*.yaml"))
119+
then select(.name | contains("caller:" + $callerRunId))
120+
else .
121+
end
122+
| .url')
119123
120124
if [[ -n "$workflow_run_url" && "$workflow_run_url" != null ]]; then
121125
ui_url=${workflow_run_url/api./}

0 commit comments

Comments
 (0)