Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Composable GitHub Actions workflow patterns for .NET projects: reusable workflows with workflow_call, composite
actions for shared step sequences, matrix builds across TFMs and operating systems, path-based triggers, concurrency
groups for duplicate run cancellation, environment protection rules, NuGet and SDK caching strategies, and
workflow_dispatch inputs for manual triggers.
Version assumptions: GitHub Actions workflow syntax v2. actions/setup-dotnet@v4 for .NET 8/9/10 support.
actions/cache@v4 for dependency caching.
Scope
Reusable workflows with workflow_call
Composite actions for shared step sequences
Matrix builds across TFMs and operating systems
Path-based triggers and concurrency groups
NuGet and SDK caching strategies
workflow_dispatch inputs for manual triggers
Out of scope
Starter CI/CD templates -- see [skill:dotnet-add-ci]
CLI release pipelines (tag-triggered build-package-release for CLI tools) -- see [skill:dotnet-cli-release-pipeline]
Benchmark CI workflows -- see [skill:dotnet-ci-benchmarking]
Azure DevOps pipeline patterns -- see [skill:dotnet-ado-patterns]
Build/test specifics -- see [skill:dotnet-gha-build-test]
Publishing workflows -- see [skill:dotnet-gha-publish]
Deployment patterns -- see [skill:dotnet-gha-deploy]
Cross-references: [skill:dotnet-add-ci] for starter templates that these patterns extend,
[skill:dotnet-cli-release-pipeline] for CLI-specific release automation, [skill:dotnet-ci-benchmarking] for
benchmark-specific CI integration.
Reusable Workflows (workflow_call)
Defining a Reusable Workflow
Reusable workflows allow callers to invoke an entire workflow as a single step. Define inputs, outputs, and secrets for
a clean contract:
# .github/workflows/build-reusable.ymlname:Build(Reusable)on:workflow_call:inputs:dotnet-version:description:'.NET SDK version to install'required:false
[]
[]
[, , ]
[, ]
[]
[]
[]
[]
type:
string
default:
'8.0.x'
configuration:
description:
'Build configuration'
required:
false
type:
string
default:
'Release'
project-path:
description:
'Path to solution or project file'
required:
true
type:
string
outputs:
artifact-name:
description:
'Name of the uploaded build artifact'
value:
${{
jobs.build.outputs.artifact-name
}}
secrets:
NUGET_AUTH_TOKEN:
description:
'NuGet feed authentication token'
required:
false
jobs:
build:
runs-on:
ubuntu-latest
outputs:
artifact-name:
build-${{
github.sha
}}
steps:
-
uses:
actions/checkout@v4
-
name:
Setup
.NET
uses:
actions/setup-dotnet@v4
with:
dotnet-version:
${{
inputs.dotnet-version
}}
-
name:
Restore
run:
dotnet
restore
${{
inputs.project-path
}}
-
name:
Build
run:
dotnet
build
${{
inputs.project-path
}}
-c
${{
inputs.configuration
}}
--no-restore
-
name:
Upload
build
artifact
uses:
actions/upload-artifact@v4
with:
name:
build-${{
github.sha
}}
path:
|
**/bin/${{ inputs.configuration }}/**
retention-days:
7
```text
### Calling a Reusable Workflow
```yaml
# .github/workflows/ci.yml
name:
CI
on:
push:
branches:
main
pull_request:
branches:
main
jobs:
build:
uses:
./.github/workflows/build-reusable.yml
with:
dotnet-version:
'8.0.x'
project-path:
MyApp.sln
secrets:
NUGET_AUTH_TOKEN:
${{
secrets.NUGET_AUTH_TOKEN
}}
test:
needs:
build
uses:
./.github/workflows/test-reusable.yml
with:
dotnet-version:
'8.0.x'
project-path:
MyApp.sln
```yaml
### Cross-Repository Reusable Workflows
Reference workflows from other repositories using the full path: