Skip to content

Commit 8de4373

Browse files
committed
test
1 parent d28f8ee commit 8de4373

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

.github/workflows/test-copilot.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ jobs:
88
steps:
99
- uses: austenstone/copilot-cli-actions/.github/actions/copilot@main
1010
with:
11-
github-token: ${{ secrets.PAT }}
12-
# mcp-config: |
13-
# {
14-
# "mcpServers": {
15-
# "time": {
16-
# "command": "uvx",
17-
# "args": [
18-
# "mcp-server-time",
19-
# "--local-timezone",
20-
# "America/New_York"
21-
# ],
22-
# "tools": ["*"]
23-
# }
24-
# }
25-
# }
11+
github-token: ${{ secrets.GITHUB_TOKEN }}
12+
mcp-config: |
13+
{
14+
"mcpServers": {
15+
"time": {
16+
"command": "uvx",
17+
"args": [
18+
"mcp-server-time",
19+
"--local-timezone",
20+
"America/New_York"
21+
],
22+
"tools": ["*"]
23+
}
24+
}
25+
}
2626
prompt: |
2727
Try to experiment with mcp tools available to see what they do and if they work.
2828

README.md

14.7 KB

copilot-cli-actions

Search for examples on GitHub "copilot -p" path:.github/workflows/*.yml

You need to use fine-grained personal access tokens for now New fine-grained personal access token

GitHub Copilot CLI Action 🤖

A GitHub Action wrapper for the GitHub Copilot CLI that enables AI-powered automation in your CI/CD workflows.

Installation

Token

Create a new fine-grained personal access token

Basic Setup

Add the following workflow to your .github/workflows folder:

name: 'Copilot Automation'
on:
  pull_request:

jobs:
  copilot-task:
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout Repository'
        uses: actions/checkout@v4
      - name: 'Run Copilot CLI'
        uses: austenstone/copilot-cli-actions@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          prompt: 'Analyze this pull request and provide feedback on code quality'

Advanced Setup with MCP Servers

name: 'Advanced Copilot Automation'
on: [issues, pull_request]

jobs:
  copilot-advanced:
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout Repository'
        uses: actions/checkout@v4
      - name: 'Run Copilot with Custom Config'
        uses: austenstone/copilot-cli-actions@v1
        with:
          github-token: ${{ secrets.COPILOT_TOKEN }}
          prompt: |
            Review this pull request for:
            1. Code quality and best practices
            2. Security vulnerabilities
            3. Performance implications
            4. Documentation completeness
          model: 'claude-sonnet-4.5'
          allow-all-tools: true
          mcp-config: |
            {
              "mcpServers": {
                "custom-api": {
                  "type": "http",
                  "url": "https://api.example.com/mcp",
                  "headers": {
                    "Authorization": "Bearer ${{ secrets.API_TOKEN }}"
                  }
                }
              }
            }

Configuration

Input Parameters

Parameter Description Required Default
github-token GitHub Personal Access Token with required permissions -
prompt Natural language prompt to send to GitHub Copilot -
mcp-config MCP server configuration in JSON format {}
copilot-config GitHub Copilot CLI configuration See below
log-level Logging verbosity level all
allow-all-tools Allow all tools without approval ⚠️ true
denied-tools Comma-separated list of tools to deny ''
copilot-version Version of @github/copilot to install latest
model AI model to use ''
additional-directories Additional directories to trust for file access ''
disable-mcp-servers MCP servers to disable ''
no-color Disable color output true
screen-reader Enable screen reader optimizations false
resume-session Resume from previous session ''
show-banner Show animated startup banner false
upload-artifact Upload logs and trajectory as artifacts true

Default Copilot Configuration

{
  "banner": "never",
  "render_markdown": true,
  "theme": "auto",
  "trusted_folders": []
}

MCP Server Configuration

The action supports Model Context Protocol (MCP) servers for extending Copilot's capabilities:

mcp-config: |
  {
    "mcpServers": {
      "database-server": {
        "type": "http",
        "url": "https://your-db-mcp-server.com",
        "headers": {
          "Authorization": "Bearer ${{ secrets.DB_TOKEN }}"
        },
        "tools": ["query_db", "update_schema"]
      },
      "context7": {
        "type": "http",
        "url": "https://mcp.context7.com/mcp",
        "headers": {
          "CONTEXT7_API_KEY": "YOUR_API_KEY"
        },
        "tools": ["get-library-docs", "resolve-library-id"]
      }
    }
  }

Model Selection

Supported models include:

  • claude-sonnet-4.5 (recommended)
  • claude-sonnet-4
  • gpt-5
  • gpt-4o

Outputs

The action provides several outputs that can be used by subsequent steps:

Output Description
trajectory-path Path to the trajectory markdown file containing the full interaction log
logs-path Path to the copilot logs directory
exit-code Exit code from the Copilot CLI command (0 = success)

Examples

Code Review Automation

name: 'AI Code Review'
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  ai-review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: austenstone/copilot-cli-actions@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          prompt: |
            Please review this pull request and:
            1. Check for potential bugs or security issues
            2. Suggest improvements for code quality
            3. Verify that tests cover the new functionality
            4. Comment on the PR with your findings
          model: 'claude-sonnet-4.5'

Issue Triage and Labeling

name: 'AI Issue Triage'
on:
  issues:
    types: [opened]

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: austenstone/copilot-cli-actions@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          prompt: |
            Analyze this new issue and:
            1. Categorize it (bug, feature, documentation, etc.)
            2. Estimate complexity/priority
            3. Add appropriate labels
            4. Suggest potential assignees based on the codebase

Documentation Generation

name: 'Generate Documentation'
on:
  push:
    branches: [main]
    paths: ['src/**/*.ts', 'src/**/*.js']

jobs:
  docs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: austenstone/copilot-cli-actions@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          prompt: |
            Update the README.md file to reflect any API changes in the recent commits.
            Focus on:
            1. New functions and classes
            2. Changed method signatures
            3. Updated usage examples
            4. Breaking changes

Troubleshooting

Common Issues

  1. Permission Denied Errors

    • Ensure your GitHub token has the required permissions
    • Check that the token hasn't expired
  2. Tool Access Denied

    • Review your denied-tools configuration
    • Consider setting allow-all-tools: false for better security
  3. MCP Server Connection Issues

    • Verify MCP server URLs are accessible
    • Check authentication headers and tokens
  4. Large Output Truncation

    • Use no-color: true to reduce output size
    • Consider breaking complex prompts into smaller tasks

Debug Mode

Enable detailed logging by setting:

log-level: 'debug'
no-color: false

Contributing

We welcome contributions! Please see our contributing guidelines for details on:

  • Reporting bugs
  • Suggesting enhancements
  • Submitting pull requests
  • Code style requirements

License

This project is licensed under the MIT License.

Related Resources

0 commit comments

Comments
 (0)