Skip to content

Optimize CI/CD workflows: add caching, security scanning, and artifact preservation#4

Merged
csMACnz merged 4 commits intomainfrom
copilot/review-github-actions-build-test
Feb 25, 2026
Merged

Optimize CI/CD workflows: add caching, security scanning, and artifact preservation#4
csMACnz merged 4 commits intomainfrom
copilot/review-github-actions-build-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 25, 2026

GitHub Actions workflows lacked caching, security scanning, and proper artifact preservation, resulting in slow builds and no proactive vulnerability detection.

Performance (40-50% faster)

  • NuGet package caching: ~/.nuget/packages keyed on .csproj hashes (30-60s → 5-10s)
  • Playwright browser caching: ~/.cache/ms-playwright conditional installation (20-30s → 2-5s)
  • Consolidated deploy workflow: merged duplicate test+build jobs, eliminated redundant restore/build steps
  • Release configuration: all builds now use --configuration Release

Security

  • CodeQL workflow: C# security-and-quality analysis on PR/push/weekly schedule
  • Dependency review workflow: blocks moderate+ severity vulnerabilities on PRs with inline comments

Reliability & Debugging

  • Test artifacts: TRX logs uploaded on all runs (including failures), 30-day retention
  • Build artifacts: generated site preserved per-run, PR-specific naming (generated-site-pr-{number})
  • Timeout limits: 15min build/test, 10min deploy/review jobs
  • PR automation: status comments with artifact links via actions/github-script

Workflow Changes

# Before: separate jobs, no caching
jobs:
  test:  # restore, build, test
  build: # restore, build again, deploy
  
# After: consolidated, cached
jobs:
  build-and-test:
    - uses: actions/cache@v4  # NuGet
    - uses: actions/cache@v4  # Playwright
    - run: dotnet build --configuration Release
    - uses: upload-artifact@v4  # test-results, always()

Documentation

  • .github/workflows/README.md: workflow reference, badges, troubleshooting
  • WORKFLOW_IMPROVEMENTS.md: metrics, before/after comparison
  • WORKFLOW_VISUAL_GUIDE.md: architecture diagrams
  • Workflow status badges in main README

Permissions

Scoped per workflow following least privilege:

  • deploy.yml: pages:write, id-token:write, checks:write
  • pr-validation.yml: pull-requests:write, checks:write
  • codeql.yml: security-events:write
  • dependency-review.yml: pull-requests:write

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 25, 2026 09:47
Co-authored-by: csMACnz <1768046+csMACnz@users.noreply.github.com>
Co-authored-by: csMACnz <1768046+csMACnz@users.noreply.github.com>
Co-authored-by: csMACnz <1768046+csMACnz@users.noreply.github.com>
Copilot AI changed the title [WIP] Review and improve GitHub actions for build and test Optimize CI/CD workflows: add caching, security scanning, and artifact preservation Feb 25, 2026
Copilot AI requested a review from csMACnz February 25, 2026 09:52
@github-actions
Copy link
Copy Markdown
Contributor

✅ Build and tests passed! Generated site artifact is available for download from the workflow run.

@github-advanced-security
Copy link
Copy Markdown
Contributor

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@github-actions
Copy link
Copy Markdown
Contributor

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 3 package(s) with unknown licenses.
See the Details below.

License Issues

.github/workflows/pr-validation.yml

PackageVersionLicenseIssue Type
actions/cache4.*.*NullUnknown License
actions/github-script7.*.*NullUnknown License
actions/upload-artifact4.*.*NullUnknown License

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/cache 4.*.* 🟢 6.3
Details
CheckScoreReason
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Code-Review🟢 10all changesets reviewed
Packaging⚠️ -1packaging workflow not detected
Maintained🟢 1030 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies🟢 3dependency not pinned by hash detected -- score normalized to 3
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
SAST🟢 10SAST tool is run on all commits
actions/actions/github-script 7.*.* 🟢 7.7
Details
CheckScoreReason
Maintained🟢 1013 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Code-Review🟢 10all changesets reviewed
Binary-Artifacts🟢 10no binaries found in the repo
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Pinned-Dependencies⚠️ 1dependency not pinned by hash detected -- score normalized to 1
Token-Permissions🟢 9detected GitHub workflow tokens with excessive permissions
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection🟢 5branch protection is not maximal on development and all release branches
SAST🟢 10SAST tool is run on all commits
actions/actions/upload-artifact 4.*.* 🟢 6.2
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Maintained🟢 1027 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Packaging⚠️ -1packaging workflow not detected
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Binary-Artifacts🟢 10no binaries found in the repo
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Pinned-Dependencies⚠️ 1dependency not pinned by hash detected -- score normalized to 1
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
SAST🟢 10SAST tool is run on all commits

Scanned Files

  • .github/workflows/pr-validation.yml

@csMACnz csMACnz marked this pull request as ready for review February 25, 2026 10:00
@csMACnz csMACnz merged commit 0ec27e1 into main Feb 25, 2026
4 of 5 checks passed
@csMACnz csMACnz deleted the copilot/review-github-actions-build-test branch February 25, 2026 10:00
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.

3 participants