Skip to content

Commit c94c1ae

Browse files
committed
chore: enable copilot PR review
1 parent 6304887 commit c94c1ae

File tree

3 files changed

+269
-0
lines changed

3 files changed

+269
-0
lines changed

.github/COPILOT_PR_REVIEW.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# GitHub Copilot PR Review Setup
2+
3+
This repository is prepared for GitHub Copilot PR reviews and currently includes enhanced PR analysis workflows to maintain code quality and consistency in the SAP Fundamental Styles design system.
4+
5+
## Current Features
6+
7+
### Automated PR Analysis
8+
- **Triggers**: Runs automatically on PR open, synchronize, and reopened events
9+
- **Focus Areas**: SCSS/CSS quality, accessibility, performance, design consistency
10+
- **File Detection**: Automatically identifies changed SCSS files in packages
11+
- **Custom Analysis**: Tailored for design system components and utilities
12+
13+
### PR Summaries & Checklists
14+
- **Auto-generated summaries** for new PRs with context about the design system
15+
- **Review checklists** covering all important aspects (BEM, accessibility, performance)
16+
- **Repository context** and branch information
17+
18+
### Future GitHub Copilot Integration
19+
- **Ready for activation** when GitHub Copilot PR actions become publicly available
20+
- **Pre-configured** with design system specific review criteria
21+
- **Seamless upgrade path** from current analysis to AI-powered reviews
22+
23+
## How It Works
24+
25+
### Current Workflow
26+
1. **Open a PR** → Automated analysis generates summary and review checklist
27+
2. **Push changes** → Workflow re-analyzes changed SCSS files
28+
3. **Manual review** → Use the provided checklist and analysis results
29+
30+
### Future Copilot Integration
31+
1. **Open a PR** → Copilot will automatically generate summary and perform AI review
32+
2. **Push changes** → Copilot will review updated code automatically
33+
3. **Interactive feedback** → Comment `@copilot review this change for accessibility` for targeted AI feedback
34+
35+
## Review Focus Areas
36+
37+
The Copilot reviewer is configured to pay special attention to:
38+
39+
-**SCSS Code Quality**: Syntax, best practices, nesting depth
40+
-**BEM Methodology**: CSS class naming conventions
41+
-**Design Tokens**: Consistent usage of variables and mixins
42+
-**Accessibility**: WCAG compliance, focus indicators, screen reader support
43+
-**Performance**: CSS selector efficiency, bundle size impact
44+
-**Cross-browser Compatibility**: Vendor prefixes, fallbacks
45+
-**Breaking Changes**: API and styling compatibility
46+
-**Documentation**: Requirements for new features
47+
48+
## Configuration
49+
50+
The review behavior is customized through:
51+
- `.github/workflows/copilot-pr-review.yml` - Main workflow configuration
52+
- `.github/copilot-review-config.yml` - Repository-specific review settings
53+
54+
## File Exclusions
55+
56+
The following files are excluded from detailed review to focus on relevant code:
57+
- Documentation files (*.md)
58+
- Story files (*.stories.*)
59+
- Configuration files (package.json, etc.)
60+
- Build artifacts and dependencies
61+
62+
## Current Usage
63+
64+
### Automated Analysis
65+
The workflow automatically:
66+
- Detects changed SCSS files in `packages/*/src/**/*.scss`
67+
- Generates analysis summaries in the GitHub Actions summary
68+
- Provides review checklists for manual verification
69+
- Reports on file changes and areas of focus
70+
71+
### Manual Review Process
72+
Use the generated checklist to verify:
73+
- SCSS syntax and best practices
74+
- BEM naming conventions
75+
- Design token consistency
76+
- Accessibility compliance
77+
- Performance implications
78+
- Breaking changes assessment
79+
80+
## Future Copilot Usage Examples
81+
82+
When GitHub Copilot PR actions become available, you'll be able to:
83+
84+
### Request Specific AI Review Types
85+
```
86+
@copilot review this SCSS for accessibility compliance
87+
@copilot check if these changes introduce breaking changes
88+
@copilot analyze the performance impact of this CSS
89+
@copilot review the BEM naming conventions in this component
90+
```
91+
92+
### Manual AI Trigger
93+
If the automatic AI review doesn't trigger, you'll be able to:
94+
1. Close and reopen the PR, or
95+
2. Add a comment with `@copilot review`
96+
97+
## Benefits
98+
99+
- **Consistent Quality**: Automated checks for design system standards
100+
- **Accessibility Focus**: Built-in accessibility review expertise
101+
- **Performance Awareness**: Early detection of performance issues
102+
- **Learning Tool**: Educational feedback for contributors
103+
- **Time Saving**: Reduces manual review overhead
104+
105+
## Next Steps
106+
107+
The Copilot PR review action will start working immediately on new PRs. You can customize the behavior by editing the configuration files as needed for your team's specific requirements.

.github/copilot-review-config.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# GitHub Copilot PR Review Configuration
2+
# This file configures how Copilot reviews PRs in the fundamental-styles repository
3+
4+
# Repository context
5+
repository:
6+
type: "design-system"
7+
language: "scss"
8+
framework: "sass"
9+
description: "SAP Fundamental Styles - A design system providing styling for SAP applications"
10+
11+
# Review focus areas
12+
focus_areas:
13+
- "SCSS/CSS code quality"
14+
- "Design system consistency"
15+
- "Accessibility compliance"
16+
- "Performance optimization"
17+
- "Breaking changes detection"
18+
- "Cross-browser compatibility"
19+
20+
# Coding standards to check
21+
standards:
22+
scss:
23+
- "BEM naming convention for CSS classes"
24+
- "Consistent use of design tokens and variables"
25+
- "Proper nesting depth (max 3-4 levels)"
26+
- "Consistent spacing and formatting"
27+
- "Use of mixins for reusable patterns"
28+
29+
accessibility:
30+
- "Color contrast ratios meet WCAG guidelines"
31+
- "Focus indicators are visible and accessible"
32+
- "Semantic HTML structure support"
33+
- "Screen reader compatibility"
34+
35+
performance:
36+
- "CSS selector efficiency"
37+
- "Bundle size impact"
38+
- "Critical path CSS considerations"
39+
- "Unused CSS detection"
40+
41+
# Files to prioritize in reviews
42+
priority_patterns:
43+
- "packages/*/src/**/*.scss"
44+
- "packages/common-css/src/**/*.scss"
45+
- "packages/styles/src/**/*.scss"
46+
47+
# Files to exclude from detailed review
48+
exclude_patterns:
49+
- "**/*.stories.ts"
50+
- "**/*.stories.js"
51+
- "**/CHANGELOG.md"
52+
- "node_modules/**"
53+
- "dist/**"
54+
- ".nx/**"
55+
56+
# Custom review prompts
57+
custom_prompts:
58+
breaking_changes: "Analyze if these changes introduce breaking changes to the public API or existing component styles"
59+
accessibility: "Review the accessibility impact of these styling changes, particularly for screen readers and keyboard navigation"
60+
performance: "Evaluate the performance impact of these CSS changes on bundle size and rendering performance"
61+
consistency: "Check if these changes maintain consistency with the existing design system patterns and conventions"
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Copilot PR Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
pull_request_review_comment:
7+
types: [created, edited]
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
issues: write
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
# GitHub Copilot for PRs is currently in private preview
20+
# This job will use available alternatives until the official action is released
21+
pr-analysis:
22+
runs-on: ubuntu-latest
23+
name: PR Code Analysis
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4.2.2
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Get PR Files
31+
id: changed-files
32+
uses: tj-actions/changed-files@v40
33+
with:
34+
files: |
35+
packages/*/src/**/*.scss
36+
packages/common-css/src/**/*.scss
37+
packages/styles/src/**/*.scss
38+
separator: ","
39+
40+
- name: Analyze SCSS Files
41+
if: steps.changed-files.outputs.any_changed == 'true'
42+
run: |
43+
echo "## 🎨 SCSS/CSS Analysis Report" >> $GITHUB_STEP_SUMMARY
44+
echo "" >> $GITHUB_STEP_SUMMARY
45+
echo "### Files Changed:" >> $GITHUB_STEP_SUMMARY
46+
47+
IFS=',' read -ra CHANGED_FILES <<< "${{ steps.changed-files.outputs.all_changed_files }}"
48+
for file in "${CHANGED_FILES[@]}"; do
49+
echo "- \`$file\`" >> $GITHUB_STEP_SUMMARY
50+
done
51+
52+
echo "" >> $GITHUB_STEP_SUMMARY
53+
echo "### Analysis Summary:" >> $GITHUB_STEP_SUMMARY
54+
echo "- **Files analyzed**: ${#CHANGED_FILES[@]}" >> $GITHUB_STEP_SUMMARY
55+
echo "- **Focus areas**: SCSS quality, BEM conventions, accessibility, performance" >> $GITHUB_STEP_SUMMARY
56+
echo "- **Status**: ✅ Ready for manual review with Copilot integration pending" >> $GITHUB_STEP_SUMMARY
57+
58+
echo "" >> $GITHUB_STEP_SUMMARY
59+
echo "### 🤖 GitHub Copilot Integration" >> $GITHUB_STEP_SUMMARY
60+
echo "GitHub Copilot for PRs is currently in preview. Once available, this workflow will:" >> $GITHUB_STEP_SUMMARY
61+
echo "- Automatically review SCSS code quality" >> $GITHUB_STEP_SUMMARY
62+
echo "- Check BEM naming conventions" >> $GITHUB_STEP_SUMMARY
63+
echo "- Validate accessibility compliance" >> $GITHUB_STEP_SUMMARY
64+
echo "- Analyze performance implications" >> $GITHUB_STEP_SUMMARY
65+
echo "- Detect potential breaking changes" >> $GITHUB_STEP_SUMMARY
66+
67+
pr-summary:
68+
runs-on: ubuntu-latest
69+
name: Generate PR Summary
70+
if: github.event.action == 'opened'
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v4.2.2
74+
with:
75+
fetch-depth: 0
76+
77+
- name: Generate Summary
78+
run: |
79+
echo "## 📋 Pull Request Summary" >> $GITHUB_STEP_SUMMARY
80+
echo "" >> $GITHUB_STEP_SUMMARY
81+
echo "### Repository Context" >> $GITHUB_STEP_SUMMARY
82+
echo "- **Project**: SAP Fundamental Styles" >> $GITHUB_STEP_SUMMARY
83+
echo "- **Type**: Design System (SCSS Components & Utilities)" >> $GITHUB_STEP_SUMMARY
84+
echo "- **Branch**: \`${{ github.head_ref }}\`" >> $GITHUB_STEP_SUMMARY
85+
echo "" >> $GITHUB_STEP_SUMMARY
86+
87+
echo "### Review Checklist" >> $GITHUB_STEP_SUMMARY
88+
echo "Please ensure the following are reviewed:" >> $GITHUB_STEP_SUMMARY
89+
echo "- [ ] SCSS syntax and best practices" >> $GITHUB_STEP_SUMMARY
90+
echo "- [ ] BEM naming conventions" >> $GITHUB_STEP_SUMMARY
91+
echo "- [ ] Design token consistency" >> $GITHUB_STEP_SUMMARY
92+
echo "- [ ] Accessibility (WCAG) compliance" >> $GITHUB_STEP_SUMMARY
93+
echo "- [ ] Cross-browser compatibility" >> $GITHUB_STEP_SUMMARY
94+
echo "- [ ] Performance implications" >> $GITHUB_STEP_SUMMARY
95+
echo "- [ ] Breaking changes assessment" >> $GITHUB_STEP_SUMMARY
96+
echo "- [ ] Documentation updates (if needed)" >> $GITHUB_STEP_SUMMARY
97+
98+
echo "" >> $GITHUB_STEP_SUMMARY
99+
echo "### 🚀 Future Enhancement" >> $GITHUB_STEP_SUMMARY
100+
echo "This workflow is prepared for GitHub Copilot PR review integration." >> $GITHUB_STEP_SUMMARY
101+
echo "Once the official actions are available, automated AI reviews will be enabled." >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)