From c2cfac4cbe6f419dc6870a08479f3a275dd8bdb0 Mon Sep 17 00:00:00 2001 From: Tejas Kumar Date: Tue, 18 May 2021 17:06:35 +0200 Subject: [PATCH] Use Octokit's previews API Signed-off-by: Tejas Kumar --- .../src/scaffolder/stages/publish/helpers.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/helpers.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/helpers.ts index dcf444fa6c..9d5effa8b2 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/helpers.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/helpers.ts @@ -89,16 +89,15 @@ export const enableBranchProtectionOnDefaultRepoBranch = async ({ try { await client.repos.updateBranchProtection({ - headers: { - Accept: - /** - * 👇 we need this header because allowing a custom - * reviewer count on branch protection is a preview - * feature. - * - * More here: https://docs.github.com/en/rest/overview/api-previews#require-multiple-approving-reviews - */ - 'application/vnd.github.luke-cage-preview+json', + mediaType: { + /** + * 👇 we need this preview because allowing a custom + * reviewer count on branch protection is a preview + * feature. + * + * More here: https://docs.github.com/en/rest/overview/api-previews#require-multiple-approving-reviews + */ + previews: ['luke-cage-preview'], }, owner, repo: repoName,