Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Expose GitHub App authentication for CI/CD publishers

未关闭
#677 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
azure, csharp, github, github-actions

调研方向

从 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 内容生成。

描述

Issue-Feature
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:

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 env WINGET_CREATE_GITHUB_APP_ID
  • --github-app-private-key-file <path> or env WINGET_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):

  1. If --token / WINGET_CREATE_GITHUB_TOKEN set → use as-is (PAT path)
  2. Else if App ID + private key present → call GetGitHubAppInstallationAccessToken and use the returned installation token
  3. 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 --setup helper subcommand mirroring wingetcreate token -s if 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/winget-create 的其他 Issue

查看 microsoft/winget-create 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。