chore: skip .NET steps on PR when server paths unchanged
parent
7b6d106240
commit
0fd2dfe780
|
|
@ -1,6 +1,8 @@
|
||||||
# Build and test the C# solution (server + tests). Targets repo root NeonSprawl.sln.
|
# Build and test the C# solution (server + tests). Targets repo root NeonSprawl.sln.
|
||||||
# pull_request has no paths filter so this job always runs on PRs to main — add check
|
# PRs: workflow always runs (so ".NET / build" can be a required check). Path-sensitive
|
||||||
# ".NET / build" under branch protection required status checks (see PR gate workflow comment).
|
# work uses step-level `if` — skipped steps still leave the job successful (unlike a
|
||||||
|
# workflow skipped via `on.paths`, which leaves the required check missing/pending).
|
||||||
|
# push: path filter on `on` avoids redundant runs on unrelated commits to main.
|
||||||
name: .NET
|
name: .NET
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
@ -34,18 +36,37 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Detect .NET-relevant changes (PR only)
|
||||||
|
id: paths
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
uses: dorny/paths-filter@v3
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
server:
|
||||||
|
- "NeonSprawl.sln"
|
||||||
|
- "server/**"
|
||||||
|
- ".github/workflows/dotnet.yml"
|
||||||
|
|
||||||
|
- name: Skip .NET build (no server-side paths in this PR)
|
||||||
|
if: github.event_name == 'pull_request' && steps.paths.outputs.server != 'true'
|
||||||
|
run: echo "Skipping .NET restore, build, and tests."
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.server == 'true'
|
||||||
uses: actions/setup-dotnet@v4
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: 10.0.x
|
dotnet-version: 10.0.x
|
||||||
|
|
||||||
- name: Restore
|
- name: Restore
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.server == 'true'
|
||||||
run: dotnet restore NeonSprawl.sln
|
run: dotnet restore NeonSprawl.sln
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.server == 'true'
|
||||||
run: dotnet build NeonSprawl.sln --no-restore --configuration Release
|
run: dotnet build NeonSprawl.sln --no-restore --configuration Release
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.server == 'true'
|
||||||
env:
|
env:
|
||||||
ConnectionStrings__NeonSprawl: >-
|
ConnectionStrings__NeonSprawl: >-
|
||||||
Host=localhost;Port=5432;Database=neon_sprawl;Username=neon_sprawl;Password=neon_sprawl_dev
|
Host=localhost;Port=5432;Database=neon_sprawl;Username=neon_sprawl;Password=neon_sprawl_dev
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue