Skip to content

Commit 2a229db

Browse files
committed
Optimize CI/CD workflow by adding smart build skipping for markdown-only changes
1 parent ced6ffa commit 2a229db

File tree

2 files changed

+45
-8
lines changed

2 files changed

+45
-8
lines changed

.github/workflows/build.yml

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,41 @@ env:
1919
CI: true
2020

2121
jobs:
22+
# Check if we should skip build for markdown-only changes
23+
check-changes:
24+
runs-on: ubuntu-latest
25+
outputs:
26+
should-skip: ${{ steps.skip-check.outputs.should-skip }}
27+
paths-result: ${{ steps.skip-check.outputs.paths-result }}
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Check for non-markdown changes
35+
id: skip-check
36+
uses: fkirc/skip-duplicate-actions@v5
37+
with:
38+
# Skip if only markdown files changed
39+
paths_ignore: '["**/*.md", "doc/**", "**/README*", "**/CHANGELOG*", "**/LICENSE*"]' # Don't skip on main branch or tags
40+
skip_after_successful_duplicate: 'false'
41+
42+
# Simple job for markdown-only changes
43+
markdown-check:
44+
runs-on: ubuntu-latest
45+
needs: check-changes
46+
if: needs.check-changes.outputs.should-skip == 'true'
47+
steps:
48+
- name: Documentation changes only
49+
run: |
50+
echo "✅ Only documentation files were changed - skipping build"
51+
echo "📝 Changes detected in markdown files only"
52+
2253
build:
2354
runs-on: ubuntu-latest
55+
needs: check-changes
56+
if: needs.check-changes.outputs.should-skip != 'true'
2457

2558
strategy:
2659
matrix:
@@ -89,11 +122,12 @@ jobs:
89122
name: build-artifacts-${{ matrix.configuration }}
90123
path: |
91124
src/NLWebNet/bin/Release/
92-
demo/bin/Release/
93-
retention-days: 7
125+
demo/bin/Release/ retention-days: 7
126+
94127
code-quality:
95128
runs-on: ubuntu-latest
96-
needs: build
129+
needs: [check-changes, build]
130+
if: needs.check-changes.outputs.should-skip != 'true'
97131

98132
steps:
99133
- name: Checkout code
@@ -115,9 +149,11 @@ jobs:
115149
116150
- name: Check formatting
117151
run: dotnet format --verify-no-changes --verbosity diagnostic
152+
118153
security-scan:
119154
runs-on: ubuntu-latest
120-
needs: build
155+
needs: [check-changes, build]
156+
if: needs.check-changes.outputs.should-skip != 'true'
121157

122158
steps:
123159
- name: Checkout code
@@ -138,12 +174,12 @@ jobs:
138174
echo "❌ Vulnerable packages found!"
139175
exit 1
140176
else
141-
echo "✅ No vulnerable packages found."
142-
fi
177+
echo "✅ No vulnerable packages found." fi
178+
143179
package-validation:
144180
runs-on: ubuntu-latest
145-
needs: build
146-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
181+
needs: [check-changes, build]
182+
if: needs.check-changes.outputs.should-skip != 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
147183

148184
steps:
149185
- name: Checkout code

doc/todo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ The demo application is now fully functional with a modern .NET 9 Blazor Web App
5656
-**Testing Framework Migration**: Migrated from xUnit to MSTest 3.9.3 with code coverage support and .NET 9 compatibility
5757
-**Package Compatibility**: Ensured all dependencies are stable .NET 9 compatible versions (except ModelContextProtocol which is appropriately in preview)
5858
-**CI/CD Stability**: Fixed GitHub Actions workflow permissions, removed invalid parameters, and verified YAML formatting
59+
-**CI/CD Optimization**: Added smart build skipping for markdown-only changes to save CI/CD resources and time
5960
-**Production Ready**: All builds (Debug/Release) work correctly, demo app runs successfully at <http://localhost:5038>
6061

6162
The project is now ready for Phase 4 (MCP Integration) with a solid foundation of tested, extensible business logic.

0 commit comments

Comments
 (0)