Expose GitHub App authentication for CI/CD publishers
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- azure, csharp, github, github-actions
- 领域
- authentication, cli, devops, documentation
调研方向
从 src/WingetCreateCore/Common/GitHub.cs 和 BaseCommand.LoadGitHubClient(或其等效项)开始,然后检查 GitHubTestsBase.cs 测试框架和支持 submit 的命令。跟踪现有的 app-token 路径,并在检查 doc/token.md 之前定义 CLI/环境优先级。完成的标准是:应用凭据可用于列出的命令,PAT 和 OAuth 回退保持不变,并且 GitHub Actions 和 Azure Pipelines 的指导已完成文档化;单独确认跨 fork PR 的行为。
由索引模型根据 Issue 内容生成。
描述
Description of the new feature / enhancement
Expose the existing GitHub App authentication path in the winget-create CLI so publishers running wingetcreate in CI/CD can authenticate with a GitHub App installation token instead of a personal access token.
Why
Publishers running wingetcreate from GitHub Actions / Azure Pipelines / other CI keep hitting the same problem: they have to store a long-lived classic PAT (fine-grained PATs don't work today — see #595 and the validation evidence I posted there), and every time it expires their release pipeline breaks. That drives them toward "just set the PAT to never expire," which is exactly the security posture we don't want.
GitHub Apps solve this cleanly:
- Installation tokens rotate automatically (1-hour lifetime, minted on demand from a signed JWT).
- The App is scoped to specific repos and specific permissions — narrower blast radius than a classic PAT.
- The private key can be stored as a CI secret and used across many repos/publishers without human-in-the-loop rotation.
What already exists
The core code is already in the repo — it just isn't reachable from the CLI:
GitHub.GetGitHubAppInstallationAccessToken(pemKey, appId, wingetRepoOwner, wingetRepo)mints a JWT, gets the installation on the target repo, and returns a usable installation token.GitHub.GetJwtTokenhandles the RSA/JWT signing (via theJosedependency already in the project).- The test harness (
GitHubTestsBase.cs) uses this exact path today via aWINGET_CREATE_APP_KEYenv var, so it's proven working for real submit flows.
Proposed technical implementation details
1. CLI options / env vars on submit-capable commands (update, submit, new, new-locale, update-locale):
--github-app-id <id>or envWINGET_CREATE_GITHUB_APP_ID--github-app-private-key-file <path>or envWINGET_CREATE_GITHUB_APP_PRIVATE_KEY_PATH- File-based to avoid multi-line env-var pain in CI secrets
2. Token resolution precedence in BaseCommand.LoadGitHubClient() (or equivalent):
- If
--token/WINGET_CREATE_GITHUB_TOKENset → use as-is (PAT path) - Else if App ID + private key present → call
GetGitHubAppInstallationAccessTokenand use the returned installation token - Else → fall back to cached OAuth token / OAuth device flow (interactive path)
3. Docs in doc/token.md (or new doc/github-app.md):
- Step-by-step: create App at
github.com/settings/apps/new, set permissions (Contents R/W, Pull requests R/W, Metadata R, Workflows R/W — the workflows scope matters because winget-pkgs contains.github/workflows/files, per the #595 spike), generate private key, install on the publisher's fork of winget-pkgs. - CI/CD examples for GitHub Actions and Azure Pipelines showing how to load the private key from a secret file.
- Guidance on the trust model: publisher-owned App vs. central Microsoft-owned App.
4. Optional follow-ups (not required for MVP):
- Installation token caching to avoid re-minting on rapid successive commands (probably not worth it — installation tokens are 1h and most CI runs are minutes).
- A
wingetcreate app --setuphelper subcommand mirroringwingetcreate token -sif there's demand for discoverability.
Open validation
One thing still worth confirming with a small spike: does POST /repos/microsoft/winget-pkgs/pulls accept a fork-installed App's installation token cleanly for cross-fork PR creation? The existing test suite bypasses this by using SubmitPRToFork = false. Happy to run the validation the same way I did for #595 if this is picked up.
Effort estimate
- CLI plumbing + precedence: ~150 lines
- Docs + CI examples: half a day
- Validation spike (cross-fork PR with installation token): ~2 hours
- Total: ~1 dev-day for MVP, ~3 days including polished docs and CI/CD examples.
Relationship to #595
This is the actionable near-term fix for the publisher pain that #595 is tracking. Fine-grained PATs remain blocked at the GitHub platform level (roadmap#600), so #595 stays open as a "when GitHub ships" tracking issue. This issue tracks the fix we can actually ship today.
Co-authored with an AI agent.
- 主要语言
- C#
- 星标
- 651
- 派生
- 114
- 平均合并
- 10 小时 37 分钟
- 30 天内合并 PR
- 2
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/winget-create 的其他 Issue
-
Issue-Docs Needs-Triage
难度 2/5 1-3 小时 新手友好度 72/100
microsoft/winget-create#705 ·
-
Issue-Feature Needs-Triage
难度 2/5 1-3 小时 新手友好度 65/100
microsoft/winget-create#680 ·
-
Needs-Triage
难度 3/5 1-2 天 新手友好度 68/100
microsoft/winget-create#706 ·
-
Issue-Feature Needs-Triage
难度 4/5 3-5 天 新手友好度 52/100
microsoft/winget-create#701 ·
-
Issue-Feature Needs-Triage
难度 3/5 1-2 天 新手友好度 68/100
microsoft/winget-create#700 ·
查看 microsoft/winget-create 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
SubtitleEdit/subtitleedit#15462 ·
维护者通常 1 天内回复
-
:watch: Not Triaged
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
comp:instrumentation.aspnetcore
难度 2/5 1-3 小时 新手友好度 72/100
open-telemetry/opentelemetry-dotnet-contrib#5427 ·
维护者通常 1 天内回复
-
design-proposal
难度 2/5 1-3 小时 新手友好度 78/100
dotnet/aspnetcore#69592 ·
维护者通常 1 天内回复
-
Client Container Registry customer-reported needs-team-attention question Service Attention
难度 2/5 1-3 小时 新手友好度 74/100
Azure/azure-sdk-for-net#63470 · 3 条评论 · 1 个 reaction ·
维护者通常 1 天内回复