Skip to content

Pin actions, base images and NuGet packages - #37

Closed
stphnwlsh wants to merge 2 commits into
mainfrom
chore/pin-dependencies
Closed

stphnwlsh wants to merge 2 commits into
mainfrom
chore/pin-dependencies

Conversation

@stphnwlsh

@stphnwlsh stphnwlsh commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes the Pinned-Dependencies findings from OpenSSF Scorecard, which currently scores 3/10.

  • GitHub actions: actions/checkout, setup-dotnet, upload-artifact, download-artifact and github/codeql-action in the build pipeline are now pinned to commit SHAs with the version in a trailing comment, matching the third-party actions. scorecard.yml is left alone here because it is being changed in the open Scorecard publish PR, which gets the same pins.
  • Docker base images: the BASE_IMAGE_* ARGs are replaced with literal FROM lines pinned by digest (dotnet/sdk:10.0-alpine and the runtime image). Dependabot can't update images that come from ARGs, so the literal form keeps them maintained. A docker ecosystem is added to the monthly Dependabot group so the tag and digest are bumped together.
  • NuGet: Directory.Build.props turns on RestorePackagesWithLockFile, so each project now has a committed packages.lock.json, and restores fail in CI (CI=true) when a lock file is out of date. The Dockerfile now copies the source before restoring and runs dotnet restore --locked-mode. The lock files all share one name, so the old trick of copying the csproj files flat and moving them into folders doesn't work for them, and the runners' Docker doesn't support COPY --parents. Dependabot updates the lock files along with Directory.Packages.props.

Generated solutions get the lock files and the locked CI restore too. When a package is added locally, the next restore updates the lock file and it is committed with the change.

Related issues

None

Type of change

  • Bug fix
  • New feature
  • Breaking change (the generated solution or template parameters change in a way existing users will notice)
  • Refactoring or clean-up
  • Documentation
  • Build, pipeline or dependency update

Shared layers

  • This only touches the Presentation layer of this template.
  • This touches the Application or Infrastructure layers, tests, pipeline or repository setup, so it needs to be carried across all five templates.

Checklist

  • dotnet build and dotnet test pass locally with no warnings.
  • I added or updated tests, and coverage stays at or above 95% overall and 90% on changed lines.
  • I updated the README or docs where behaviour changed.
  • I checked the template still installs and creates a working solution (see CONTRIBUTING.md).

Pin GitHub actions to commit SHAs, pin the Dockerfile base images by digest, add NuGet lock files with a locked restore, and let Dependabot keep the image digests current.
The Docker engine on the GitHub runners doesn't support COPY --parents, and the lock files can't be flattened like the csproj files because they share a name.
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.81%. Comparing base (a3a115c) to head (4c281fe).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #37   +/-   ##
=======================================
  Coverage   99.81%   99.81%           
=======================================
  Files          72       72           
  Lines         555      555           
  Branches       32       32           
=======================================
  Hits          554      554           
  Partials        1        1           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stphnwlsh stphnwlsh closed this Oct 30, 2026
@stphnwlsh
stphnwlsh deleted the chore/pin-dependencies branch October 30, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant