Add GitHub App authentication support for Copilot, Claude, and Codex engines#12272
Add GitHub App authentication support for Copilot, Claude, and Codex engines#12272
Conversation
- Add App *GitHubAppConfig field to EngineConfig struct - Parse engine.app from frontmatter in engine config parsing - Update Copilot engine to skip COPILOT_GITHUB_TOKEN when app is configured - Add app variable validation step for engine.app - Generate app token mint step with copilot-requests:read permission - Pass app token to Copilot CLI via COPILOT_GITHUB_TOKEN env var - Add token invalidation step in cleanup - Update JSON schema to allow engine.app property - Create shared/copilot-app.md workflow for easy reuse Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Create test-copilot-app-auth.md workflow demonstrating app auth usage - Update shared/copilot-app.md to include engine.id - Verify app token minting, permission setting, and invalidation work correctly Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- All implementation phases complete - Backwards compatibility maintained - smoke-copilot workflow still compiles successfully - Formatting and linting passed Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| --- | ||
|
|
||
| # GitHub Copilot with App Authentication | ||
|
|
|
@pelikhan Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
Wrap documentation body in XML comment (<!-- -->) to make it invisible when imported but readable in source, following shared workflow pattern. Addresses PR feedback from @pelikhan Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| @@ -0,0 +1,43 @@ | |||
| --- | |||
There was a problem hiding this comment.
Done in ed18acb - deleted test-copilot-app-auth.md and its lock file
- Remove test-copilot-app-auth.md (no longer needed as demo) - Update smoke-copilot.md to import shared/copilot-app.md - smoke-copilot now uses GitHub App authentication - Verified compilation and app token steps are generated correctly Addresses feedback from @pelikhan Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰 |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰 |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
|
@copilot the verification shell script should receive the app configuration variable as input as the variable names may change. |
|
Refactor add_command.go into focused modules (1,218 → 610 lines) ✅
|
|
Smoke Test: Claude - PASS ✅ Last 2 merged PRs:
Overall: PASS ✅
|
- Update validate_app_support_engine_field.sh to accept APP_ID_VAR_NAME and APP_PRIVATE_KEY_VAR_NAME as parameters
- Add extractEnvVarName() helper to extract variable names from GitHub Actions expressions
- Pass extracted variable names to validation script
- Makes script reusable with different variable naming conventions
This allows users to configure engine.app with custom variable names:
app-id: ${{ vars.MY_CUSTOM_APP_ID }}
app-id: ${{ secrets.SOME_OTHER_APP_ID }}
Addresses feedback from @pelikhan
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in 0542649. The validation script now accepts variable names as parameters (APP_ID_VAR_NAME, APP_PRIVATE_KEY_VAR_NAME) and uses indirect expansion to check their values. The Go code extracts variable names from expressions like |
|
@copilot revert previous commit |
…names as parameters" This reverts commit 0542649. The validation script now uses the simpler signature: validate_app_support_engine_field.sh ENGINE_NAME DOCS_URL And expects hardcoded environment variable names: - APP_ID - APP_PRIVATE_KEY Addresses feedback from @pelikhan Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot make this feature work for claude and codex as well. the minted token should be used as the corresponding api key. |
Extend GitHub App authentication support to Claude and Codex engines: Claude engine: - Skip ANTHROPIC_API_KEY/CLAUDE_CODE_OAUTH_TOKEN when engine.app configured - Generate app token mint step - Use minted token as ANTHROPIC_API_KEY - Add token invalidation in cleanup Codex engine: - Skip CODEX_API_KEY/OPENAI_API_KEY when engine.app configured - Generate app token mint step - Use minted token as CODEX_API_KEY and OPENAI_API_KEY - Add token invalidation in cleanup Unified implementation: - Refactored invalidation to handle all engines - Reuses same validation script and patterns - Maintains backwards compatibility Addresses feedback from @pelikhan Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Implemented in e0063f2. The engine.app feature now works for all three engines:
All engines skip API key secret requirements when engine.app is configured, mint tokens automatically, and invalidate them in cleanup. Backwards compatibility maintained - existing workflows using secrets continue to work. |
Add GitHub App authentication support for Copilot, Claude, and Codex engines
Summary
This PR implements support for GitHub App authentication with the Copilot, Claude, and Codex engines through the
engine.appconfiguration field. This provides enhanced security with short-lived tokens instead of long-lived personal access tokens.Implementation Complete
Phase 1: Add engine.app configuration support
App *GitHubAppConfigfield toEngineConfigstructengine.appfrom frontmatter in engine config parsingPhase 2: Modify engine secret validation
GetRequiredSecretNames()for Copilot, Claude, and Codex enginesPhase 3: Token minting and passing
Phase 4: Create shared workflow
.github/workflows/shared/copilot-app.mdwith app configurationPhase 5: Testing and validation
Key Features
Usage Example
Direct configuration (works for any engine):
Or import the shared workflow:
Token Usage by Engine
COPILOT_GITHUB_TOKEN(replaces PAT, requestscopilot-requests:read)ANTHROPIC_API_KEY(replaces API key secret)CODEX_API_KEYandOPENAI_API_KEY(replaces API key secrets)Files Changed
pkg/workflow/engine.go- Added App field to EngineConfigpkg/workflow/copilot_engine.go- Updated secret requirements and token handlingpkg/workflow/copilot_engine_installation.go- Added app token minting for Copilotpkg/workflow/copilot_engine_execution.go- Use app token in Copilot executionpkg/workflow/claude_engine.go- Added app support, token minting, and executionpkg/workflow/codex_engine.go- Added app support, token minting, and executionpkg/workflow/compiler_yaml_main_job.go- Unified token invalidation for all enginespkg/parser/schemas/main_workflow_schema.json- Updated schemaactions/setup/sh/validate_app_support_engine_field.sh- App validation script.github/workflows/shared/copilot-app.md- Shared workflow.github/workflows/smoke-copilot.md- Updated to use shared workflowSecurity Benefits
Testing
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Changeset
Changeset