node-red-contrib-oauth2
node-red-contrib-oauth2 copied to clipboard
Add GitHub Copilot Node.js configuration and automated code review workflow
This PR implements GitHub Copilot code agent settings for Node.js runtime and adds comprehensive automated code review checks to ensure code quality and documentation consistency.
Changes Made
🤖 GitHub Copilot Configuration
- Added
.github/copilot/agent.ymlwith Node.js runtime configuration - Enables optimal code completion and assistance for Node.js development
🔍 Automated Code Review Workflow
- Added
.github/workflows/code-review.ymlthat runs on all pull requests - Implements four key validation checks:
1. README.md Change Detection
# Warns if significant code changes are made without updating README.md
SIGNIFICANT_CHANGES=$(echo "$CHANGED_FILES" | grep -E '\.(js|json|html|md)$')
2. Front Matter Validation
Ensures proper YAML front matter formatting in markdown files:
- Single quotes required for all string values
- Non-empty description field validation
- Exceptions for booleans (
true/false) and numbers
# ✅ Correct formatting
---
title: 'Example Document'
description: 'This document shows proper formatting'
published: true
priority: 1
---
# ❌ Incorrect formatting
---
title: Example Document Without Quotes # Missing quotes
description: '' # Empty description
---
3. Instructions File Validation
Validates .instructions.md files have required structure:
- Required
applyToproperty specifying target files - Must have front matter with proper formatting
# ✅ Correct instructions file
---
description: 'Instructions for OAuth2 implementation'
applyTo: 'src/oauth2.js'
version: '1.0'
---
📚 Documentation Updates
- Updated README.md with comprehensive development section
- Added example
docs/oauth2.instructions.mddemonstrating proper formatting - Documents all validation rules with clear examples
Testing
All validation logic has been thoroughly tested:
- ✅ Front matter validation with various quote scenarios
- ✅ Instructions file validation with missing/present
applyToproperties - ✅ YAML syntax validation for all configuration files
- ✅ End-to-end workflow simulation
Benefits
- Improved Developer Experience: Copilot configuration optimizes AI assistance for Node.js
- Documentation Consistency: Automated checks ensure README stays current with code changes
- Quality Assurance: Front matter validation prevents formatting inconsistencies
- Clear Guidelines: Instructions files must specify their target scope
This implementation ensures the repository maintains high code quality standards while providing excellent developer tooling support.
This pull request was created as a result of the following prompt from Copilot chat.
Update the repository's Copilot code agent settings to use Node.js as the runtime. Additionally, automate code review checks with the following validation steps: 1. Ensure changes in README.md match the changes in the pull request. If there are no changes, or if the changes do not match, the pull request is not ready to be merged. 2. Ensure all values in front matter are wrapped in single quotes. 3. Ensure the 'description' field in front matter is not empty. 4. For '.instructions.md' files, ensure there is an 'applyTo' property in the front matter specifying the file(s) the instructions apply to.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.