Declaring required status checks with checks makes GitHub reject the branch protection update with HttpError: Invalid request.
BranchProtection.ts always sends contexts: checks.contexts ?? [], and adds checks alongside it when provided. GitHub's update-branch-protection endpoint does not accept both contexts and checks in the same request, so any use of checks fails. Using contexts instead works.
yield* GitHub.BranchProtection("main", {
owner, repository, branch: "main",
requiredStatusChecks: {
strict: false,
checks: [{ context: "Verify" }, { context: "API tests" }], // → HttpError: Invalid request.
},
});
Observed with alchemy 2.0.0-beta.80; the same code is on main (ea384f0), packages/alchemy/src/GitHub/BranchProtection.ts:433.
Suggested fix: send checks without contexts when checks is given, and contexts only otherwise.
Declaring required status checks with
checksmakes GitHub reject the branch protection update withHttpError: Invalid request.BranchProtection.tsalways sendscontexts: checks.contexts ?? [], and addschecksalongside it when provided. GitHub's update-branch-protection endpoint does not accept bothcontextsandchecksin the same request, so any use ofchecksfails. Usingcontextsinstead works.Observed with alchemy 2.0.0-beta.80; the same code is on main (ea384f0),
packages/alchemy/src/GitHub/BranchProtection.ts:433.Suggested fix: send
checkswithoutcontextswhenchecksis given, andcontextsonly otherwise.