Skip to content

Commit 82b2f21

Browse files
jbachorikclaude
andcommitted
Watch workflow run to completion in release.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a8c08ca commit 82b2f21

1 file changed

Lines changed: 46 additions & 25 deletions

File tree

utils/release.sh

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -427,24 +427,43 @@ if gh workflow run release-validated.yml \
427427
WORKFLOW_SUCCESS=true
428428
echo ""
429429
print_success "✓ Workflow triggered successfully!"
430-
echo ""
431-
print_info "Monitor the workflow run:"
432-
echo " gh run list --workflow=release-validated.yml --limit 1"
433-
echo ""
434-
print_info "View workflow logs:"
435-
echo " gh run watch"
436-
echo ""
437-
print_info "Or view in browser:"
438430
REPO_URL=$(gh repo view --json url -q .url)
439-
echo " ${REPO_URL}/actions/workflows/release-validated.yml"
440-
echo ""
441431

432+
# Wait for the run to appear and capture its ID
433+
print_info "Waiting for workflow run to appear..."
434+
RUN_ID=""
435+
for i in $(seq 1 15); do
436+
sleep 2
437+
RUN_ID=$(gh run list --workflow=release-validated.yml --limit 1 --json databaseId,status -q '.[0].databaseId // empty')
438+
if [ -n "$RUN_ID" ]; then
439+
break
440+
fi
441+
done
442+
443+
if [ -n "$RUN_ID" ]; then
444+
echo ""
445+
print_info "Watching workflow run ${RUN_ID}..."
446+
echo " ${REPO_URL}/actions/runs/${RUN_ID}"
447+
echo ""
448+
if gh run watch "$RUN_ID" --exit-status; then
449+
WORKFLOW_CONCLUSION="success"
450+
print_success "✓ Workflow completed successfully!"
451+
else
452+
WORKFLOW_CONCLUSION="failure"
453+
print_error "✗ Workflow failed!"
454+
echo " View logs: gh run view $RUN_ID --log-failed"
455+
fi
456+
else
457+
WORKFLOW_CONCLUSION="unknown"
458+
print_warning "Could not detect the workflow run. Monitor manually:"
459+
echo " gh run list --workflow=release-validated.yml --limit 1"
460+
fi
461+
462+
echo ""
442463
if [ "$DRY_RUN" == "false" ]; then
443464
print_info "Next Steps:"
444-
echo " 1. Monitor the GitHub Actions workflow"
445-
echo " 2. GitLab pipeline will build and publish to Maven Central"
446-
echo " 3. GitHub release will be created automatically"
447-
echo " 4. Check releases: ${REPO_URL}/releases"
465+
echo " 1. Verify Maven: https://repo1.maven.org/maven2/com/datadoghq/ddprof/"
466+
echo " 2. Check release: ${REPO_URL}/releases"
448467
else
449468
print_info "This was a dry-run. Review the output and run again with --no-dry-run"
450469
fi
@@ -490,20 +509,22 @@ echo ""
490509

491510
# Status and next steps
492511
if [ "$WORKFLOW_SUCCESS" = true ]; then
493-
print_success "Status: SUCCESS"
494-
echo ""
495-
echo "Next Steps:"
496-
if [ "$DRY_RUN" == "false" ]; then
497-
echo " 1. Monitor workflow: gh run watch"
498-
echo " 2. Check GitLab: [Your GitLab pipeline URL]"
499-
echo " 3. Verify Maven: https://repo1.maven.org/maven2/com/datadoghq/ddprof/"
500-
echo " 4. Check release: ${REPO_URL}/releases"
501-
else
502-
echo " → This was a DRY-RUN. No actual changes were made."
512+
if [ "${WORKFLOW_CONCLUSION:-}" = "success" ]; then
513+
print_success "Status: WORKFLOW SUCCEEDED"
514+
elif [ "${WORKFLOW_CONCLUSION:-}" = "failure" ]; then
515+
print_error "Status: WORKFLOW FAILED"
516+
echo " View logs: gh run view $RUN_ID --log-failed"
517+
elif [ "$DRY_RUN" == "true" ]; then
518+
print_success "Status: DRY-RUN COMPLETED"
519+
echo ""
520+
echo " → No actual changes were made."
503521
echo " → To perform the release, run: $0 $RELEASE_TYPE --no-dry-run --commit $SHORT_SHA"
522+
else
523+
print_warning "Status: WORKFLOW STATUS UNKNOWN"
524+
echo " Check manually: gh run list --workflow=release-validated.yml --limit 1"
504525
fi
505526
else
506-
print_error "Status: FAILED"
527+
print_error "Status: FAILED TO TRIGGER WORKFLOW"
507528
echo ""
508529
echo "Error Details:"
509530
if [ -s "$WORKFLOW_ERROR" ]; then

0 commit comments

Comments
 (0)