-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ODS-6577] Verify dependent workflows are success or not- Step Added #1189
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, please make the next changes to Publish to Docker Hub
and Docker Test
so that they don't execute 3 times every time we merge to main:
- Remove any
github.event.workflow_run.conclusion == 'success'
checks - Add a call to
ahmadnassri/action-workflow-run-wait
in a similar way we do in this workflow
@@ -41,7 +42,7 @@ jobs: | |||
build: | |||
|
|||
runs-on: ubuntu-24.04 | |||
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} | |||
if: ${{ github.event_name == 'workflow_dispatch' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, it will no longer be executed on merges to main; it will only be executed on manual dispatches.
This if
should be removed altogether.
run: | | ||
$workflowNames = @("InitDev, Smoke Tests.yml", "InitDev Postgres, Unit tests, Integration tests.yml", "InitDev, MultiTenancy.yml") | ||
$sha = "${{ github.event.workflow_run.head_sha }}" | ||
Write-Host "sha is $sha" | ||
|
||
Write-Host "Checking workflow statuses..." | ||
$allSuccess = $true | ||
|
||
foreach ($workflow in $workflowNames) { | ||
|
||
$url = "https://api.github.com/repos/Ed-Fi-Alliance-OSS/Ed-Fi-ODS-Implementation/actions/workflows/$workflow/runs?head_sha=$sha" | ||
$headers = @{ | ||
Authorization = "Bearer $env:EDFI_ODS_TOKEN" | ||
Accept = "application/vnd.github.v3+json" | ||
} | ||
|
||
$response = Invoke-RestMethod -Uri $url -Headers $headers | ||
|
||
if ($response.workflow_runs.Count -eq 0) { | ||
Write-Host "No runs found for workflow: $workflow" | ||
$allSuccess = $false | ||
break | ||
} | ||
|
||
$latestRun = $response.workflow_runs | Sort-Object -Property created_at -Descending | Select-Object -First 1 | ||
if ($latestRun.conclusion -ne "success") { | ||
Write-Host "latest Run status is $latestRun.status" | ||
$allSuccess = $false | ||
break | ||
} | ||
} | ||
|
||
if ($allSuccess) { | ||
Write-Host "All workflows completed successfully." | ||
break | ||
} | ||
|
||
if (-not $allSuccess) { | ||
Write-Host "one or more workflows failed.So cancelling the build" | ||
exit 1 | ||
} | ||
shell: pwsh | ||
# Adding a step to ensure the build job fails if it was skipped | ||
- name: Fail the build job if skipped | ||
if: ${{ needs.FindStandardAndExtensionVersions.result == 'skipped' }} | ||
run: | | ||
echo "Build job was skipped due to a failure in the previous job." | ||
exit 1 | ||
shell: pwsh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes aren't needed since the GitHub action ahmadnassri/action-workflow-run-wait that we use below already does these checks internally.
We just need to remove the if
from my previous comment so that the GitHub action gets executed.
No description provided.