A demonstration project showing how to integrate GitHub Copilot CLI with GitLab CI for automated code review.
This project demonstrates:
- A Snake game implementation with intentional code quality issues
- GitLab CI pipeline that runs GitHub Copilot CLI (
copilotcommand) on merge requests - Automated posting of AI-generated code review feedback
- .gitlab-ci.yml - GitLab CI/CD pipeline configuration
- scripts/review-mr.sh - Automated review script using Copilot CLI
See real examples of automated code reviews:
- English Review Example - Review output in English
-
Clone the repository
git clone https://gitlab.com/YOUR_USERNAME/code-review-with-copilot-cli.git cd code-review-with-copilot-cli -
Play the game locally
# Open src/index.html in your browser # Or use a local server: python -m http.server 8000 # Visit: http://localhost:8000/src/
-
Set up GitLab CI Variables
- Navigate to Settings → CI/CD → Variables
- Add
GITHUB_TOKEN(GitHub Personal Access Token with Copilot access) - Add
GITLAB_TOKEN(GitLab API token withapiscope) - Important: Do NOT mark these variables as "Protected", because MR pipelines run on non-protected branches. Protected variables are only available on protected branches (like main/master)
- Optional: Add
REVIEW_LANGUAGEvariable to set review language:en(default) - English reviewszh- Chinese reviews
-
Create a merge request to see the demo
- Create a feature branch with improvements to the Snake game
- Push your branch and create a merge request
- Watch the CI pipeline run and post Copilot review feedback
src/
├── index.html # Main game page
├── styles/
│ └── game.css # Game styling
├── scripts/
│ ├── game.js # Core game logic
│ ├── snake.js # Snake entity
│ └── utils.js # Utility functions
└── assets/ # Game assets
.gitlab-ci.yml # CI configuration
scripts/
└── review-mr.sh # Copilot review script
- GitLab account with CI/CD access
- GitHub account with Copilot subscription
- Modern web browser (Chrome, Firefox, Safari)
MIT License - See LICENSE file for details