-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (44 loc) · 1.63 KB
/
generate-tests.yml
File metadata and controls
52 lines (44 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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
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