Skip to content

Commit 93c8f5f

Browse files
committed
Optimize CI workflow with conditional documentation deployment
- Add file change detection to skip docs deployment when only non-docs files change - Update PR creation guidelines with URL parameters and branch naming best practices - Implement conditional execution for all documentation deployment steps - Add fetch-depth: 0 for proper git history access in change detection
1 parent f9fd6b4 commit 93c8f5f

File tree

2 files changed

+57
-4
lines changed

2 files changed

+57
-4
lines changed

.github/copilot-instructions.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,38 @@ julia --project=. docs/make.jl
131131

132132
- **Never use `git add .`** - Always stage files explicitly by name to avoid accidentally committing development files, notebooks, or temporary files
133133
- Use `git add <specific-file-path>` to stage only the intended files for commit
134-
- Feature branch naming: Use descriptive names like `add-tests-fix-notebook`
134+
- **Feature branch naming**: Use descriptive, purpose-driven names that enable GitHub auto-suggestions:
135+
- ✅ Good: `feature/add-fourm-site-explanation`, `fix/sidebar-center-alignment`, `docs/add-copilot-instructions`
136+
- ❌ Avoid: `feature/update-content`, `fix/stuff`, `branch1`
135137

136138
### Pull Request Creation
137139
- **ALWAYS push changes first**: Use `git push origin BRANCH_NAME` before creating PR
138140
- **Do NOT use `gh pr create`** - The GitHub CLI command doesn't work properly in this environment
139-
- **Use GitHub web interface instead**: Create PR links manually with detailed descriptions
140-
- **PR Link Format**: `https://github.com/FourMInfo/Linear_Algebra/compare/main...BRANCH_NAME`
141+
- **Use GitHub web interface with URL parameters**: Create links with embedded title and description for auto-fill
142+
- **PR Link Format with Parameters**:
143+
```
144+
https://github.com/FourMInfo/Linear_Algebra/compare/main...BRANCH_NAME?title=Your+PR+Title&body=Your+PR+Description
145+
```
146+
- **Always provide fallback copy-paste content**: Include separate, copyable title and description in case URL parameters don't work
141147
- **Include comprehensive descriptions**: Detail all changes, test coverage, and architectural improvements
142148
- **Reference issue numbers**: Link to related issues when applicable
143149

150+
#### PR Creation Template:
151+
```markdown
152+
## 🔗 Clickable PR Link:
153+
[Your PR Title](https://github.com/FourMInfo/Linear_Algebra/compare/main...BRANCH_NAME?title=Your+PR+Title&body=Your+PR+Description)
154+
155+
## 📝 Copy-Paste Title:
156+
Your PR Title
157+
158+
## 📋 Copy-Paste Description:
159+
Your comprehensive PR description with:
160+
- Summary of changes
161+
- Technical details
162+
- Testing completed
163+
- Related issues
164+
```
165+
144166
## Azure Integration
145167

146168
- Use Azure Best Practices: When generating code for Azure, running terminal commands for Azure, or performing operations related to Azure, invoke your `azure_development-get_best_practices` tool if available

.github/workflows/CI.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,45 @@ jobs:
4747
runs-on: ubuntu-latest
4848
steps:
4949
- uses: actions/checkout@v4
50-
- uses: julia-actions/setup-julia@v1
50+
with:
51+
fetch-depth: 0 # Fetch full history for path change detection
52+
53+
# Check if documentation-related files have changed
54+
- name: Check for documentation changes
55+
id: docs-changes
56+
run: |
57+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
58+
echo "Manual trigger - deploying docs"
59+
echo "docs_changed=true" >> $GITHUB_OUTPUT
60+
else
61+
# Check if any documentation-related files changed in the last commit
62+
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD)
63+
echo "Changed files: $CHANGED_FILES"
64+
65+
if echo "$CHANGED_FILES" | grep -qE '(^src/|^docs/|\.md$|Project\.toml$|Manifest\.toml$)'; then
66+
echo "Documentation-related files changed - deploying docs"
67+
echo "docs_changed=true" >> $GITHUB_OUTPUT
68+
else
69+
echo "No documentation-related files changed - skipping docs deployment"
70+
echo "docs_changed=false" >> $GITHUB_OUTPUT
71+
fi
72+
fi
73+
74+
- name: Setup Julia
75+
if: steps.docs-changes.outputs.docs_changed == 'true'
76+
uses: julia-actions/setup-julia@v1
5177
with:
5278
version: '1'
5379
arch: x64
80+
5481
- uses: julia-actions/cache@v1
82+
if: steps.docs-changes.outputs.docs_changed == 'true'
83+
5584
- uses: julia-actions/julia-buildpkg@v1
85+
if: steps.docs-changes.outputs.docs_changed == 'true'
5686

5787
- name: Generate documentation and deploy
88+
if: steps.docs-changes.outputs.docs_changed == 'true'
5889
run: >
5990
julia --project=. --color=yes docs/make.jl
6091
env: # needed for pushing to gh-pages branch

0 commit comments

Comments
 (0)