Skip to content

feat: add MCP configuration for GitHub Copilot and update workflow en… #1

feat: add MCP configuration for GitHub Copilot and update workflow en…

feat: add MCP configuration for GitHub Copilot and update workflow en… #1

name: Generate Tests with Copilot
on:
push:
paths-ignore:
- 'docs/**'
- '**.md'
- '.github/workflows/**'
- '.gitignore'
- 'LICENSE'
- '*.config.js'
- '*.config.ts'
jobs:
generate-tests:
runs-on: ubuntu-latest
permissions:
contents: read # Required to read repository content and commit diffs
issues: write # Required to create GitHub issues for test coverage recommendations
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitHub Copilot CLI
env:
GH_TOKEN: ${{ secrets.COPILOT_CLI_TOKEN }}
run: |
curl -fsSL https://gh.io/copilot-install | bash
echo "Installed Copilot CLI version:"
copilot --version
- name: Analyze and generate tests with Copilot
env:
GH_TOKEN: ${{ secrets.COPILOT_CLI_TOKEN }}
run: |
echo "Analyzing commit ${{ github.sha }} for test coverage..."
echo "Source files changed: ${{ steps.changes.outputs.source_count }}"
echo ""
# Load the prompt template
PROMPT=$(cat .github/prompts/analyze-for-tests.prompt.md)
PROMPT="${PROMPT//\{COMMIT_SHA\}/${{ github.sha }}}"
PROMPT="${PROMPT//\{REPOSITORY\}/${{ github.repository }}}"
echo "Delegating to GitHub Copilot for test analysis..."
echo "- Copilot will examine the commit diff"
echo "- Copilot will check for corresponding test files"
echo "- Copilot will assess if new tests are needed"
echo "- Copilot will create an issue if tests are recommended"
echo ""
copilot -p "$PROMPT" --enable-all-github-mcp-tools --allow-all-tools --no-ask-user