Skip to content

[ci-coach] ci: fail-fast Go format check and add copilot-setup-steps timeout #463

@github-actions

Description

@github-actions

Summary

Two small CI workflow optimizations that follow fail-fast principles and add a safety guard, with no impact on passing builds.


Optimizations

1. Go Format Check: Fail Fast Before Build & Test

Type: Job Step Ordering
Impact: ~1–2 minutes saved per run when formatting is wrong
Risk: Low

Changes:

  • Moved the gofmt format check step to run immediately after actions/setup-go in build-go, before go mod download, go build, and go test

Rationale: Previously, a formatting violation would only be caught after downloading all Go dependencies, compiling the entire module, and running all tests. By checking format first (it requires only the Go toolchain, which is already installed by setup-go), the job fails in seconds rather than waiting 1–2 minutes for the full pipeline to complete. This is the standard "fail fast" CI pattern.

Before / After Step Order

Before:

setup-go → go mod download → go build → go test → gofmt check
```

**After:**
```
setup-go → gofmt check ← fails here immediately if unformatted
         → go mod download → go build → go test

2. copilot-setup-steps: Add timeout-minutes: 10

Type: Resource Safety
Impact: Prevents runaway runner consumption
Risk: Low

Changes:

  • Added timeout-minutes: 10 to the copilot-setup-steps job in copilot-setup-steps.yml

Rationale: The job had no timeout, meaning a hung dependency install or network issue could consume a runner for the default 6-hour GitHub Actions limit. A 10-minute ceiling matches the actual expected runtime (all four language runtimes install in well under 5 minutes) while providing a clear fail signal if something goes wrong.


Expected Impact

  • Time Savings: ~1–2 minutes per build-go run where formatting fails
  • Risk Level: Low — changes only affect step ordering and add a safety timeout; no logic changes

Testing Recommendations

  • Review workflow YAML syntax
  • Monitor the first build-go run after merge to confirm step order is correct
  • Confirm copilot-setup-steps still completes within 10 minutes

Generated by CI Optimization Coach ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/ci-coach.md@b466f28f0f65b68d6f2b10b15b44f51d787b93be
  • expires on Mar 10, 2026, 11:13 AM UTC

Note

This was originally intended as a pull request, but the git push operation failed.

Workflow Run: View run details and download patch artifact

The patch file is available in the agent-artifacts artifact in the workflow run linked above.

To create a pull request with the changes:

# Download the artifact from the workflow run
gh run download 22819854915 -n agent-artifacts -D /tmp/agent-artifacts-22819854915

# Create a new branch
git checkout -b ci-optimize-go-format-timeout-a7c29d2ace9ddfb3

# Apply the patch (--3way handles cross-repo patches where files may already exist)
git am --3way /tmp/agent-artifacts-22819854915/aw-ci-optimize-go-format-timeout.patch

# Push the branch to origin
git push origin ci-optimize-go-format-timeout-a7c29d2ace9ddfb3

# Create the pull request
gh pr create --title '[ci-coach] ci: fail-fast Go format check and add copilot-setup-steps timeout' --base main --head ci-optimize-go-format-timeout-a7c29d2ace9ddfb3 --repo askpt/openfeature-aspire-sample
Show patch preview (64 of 64 lines)
From 7dae7a2eb851cec9e72ffd6c1a317e19ff26af32 Mon Sep 17 00:00:00 2001
From: Copilot <copilot@github.com>
Date: Sun, 8 Mar 2026 11:12:12 +0000
Subject: [PATCH] ci: fail-fast Go format check and add copilot-setup-steps
 timeout

- Move gofmt check before go mod download/build/test in build-go job
  so formatting failures are caught immediately without wasting time
  on dependency downloads and compilation (~1-2 min savings on failure)
- Add timeout-minutes: 10 to copilot-setup-steps job as a safety guard
  against runaway runner consumption

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 .github/workflows/ci.yml                  | 12 ++++++------
 .github/workflows/copilot-setup-steps.yml |  1 +
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d8acb01..52c3da2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -105,12 +105,6 @@ jobs:
         with:
           go-version-file: src/Garage.FeatureFlags/go.mod
           cache-dependency-path: src/Garage.FeatureFlags/go.sum
-      - name: Download dependencies
-        run: go mod download
-      - name: Build
-        run: go build -v ./...
-      - name: Test
-        run: go test -v ./...
       - name: Format check
         run: |
           if [ -n "$(gofmt -l .)" ]; then
@@ -118,6 +112,12 @@ jobs:
             gofmt -d .
             exit 1
           fi
+      - name: Download dependencies
+        run: go mod download
+      - name: Build
+        run: go build -v ./...
+      - name: Test
+        run: go test -v ./...
 
   build-python:
     needs: changes
diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml
index ed76c5f..ac30117 100644
--- a/.github/workflows/copilot-setup-steps.yml
+++ b/.github/workflows/copilot-setup-steps.yml
@@ -10,6 +10,7 @@ name: Copilot Setup Steps
 jobs:
   copilot-setup-steps:
     runs-on: ubuntu-latest
+    timeout-m
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions