Skip to content

Merge pull request #3 from DevExpGbb/copilot/sub-pr-2 #3

Merge pull request #3 from DevExpGbb/copilot/sub-pr-2

Merge pull request #3 from DevExpGbb/copilot/sub-pr-2 #3

name: Generate Documentation with Copilot
on:
push:
paths-ignore:
- 'docs/**'
- '**.md'
jobs:
generate-docs:
runs-on: ubuntu-latest
permissions:
contents: read # Required to read repository content and commit diffs
issues: write # Required to create GitHub issues for documentation 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 delegate to Copilot
env:
GH_TOKEN: ${{ secrets.COPILOT_CLI_TOKEN }}
run: |
echo "Analyzing commit ${{ github.sha }}"
echo "Loading documentation criteria from prompt..."
PROMPT=$(cat .github/prompts/analyze-for-docs.prompt.md)
PROMPT="${PROMPT//\{COMMIT_SHA\}/${{ github.sha }}}"
PROMPT="${PROMPT//\{REPOSITORY\}/${{ github.repository }}}"
echo "Delegating to GitHub Copilot..."
echo "- Copilot will use MCP to examine the commit"
echo "- Copilot will decide if documentation is needed"
echo "- Copilot will create an issue and assign it to itself if needed"
echo ""
copilot -p "$PROMPT" --enable-all-github-mcp-tools --allow-all-tools