From 3e37b5e89aadb85fb396a16319854b65597a40d4 Mon Sep 17 00:00:00 2001 From: Jerome Luckenbach Date: Sun, 28 Feb 2021 20:30:52 +0100 Subject: [PATCH] Update github release script. Signed-off-by: Jerome Luckenbach --- .../github-release/github-release.js | 9 ++++++--- .../github-release/package-lock.json | 19 +++++++++++++++++++ .azure-pipelines/github-release/package.json | 1 + 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/github-release/github-release.js b/.azure-pipelines/github-release/github-release.js index 0ec8972..538e6fb 100644 --- a/.azure-pipelines/github-release/github-release.js +++ b/.azure-pipelines/github-release/github-release.js @@ -1,4 +1,6 @@ const { Octokit } = require('@octokit/rest') +const { createActionAuth } = require("@octokit/auth-action"); + const util = require('util'); const exec = util.promisify(require('child_process').exec); const fs = require('fs'); @@ -19,15 +21,16 @@ This is intended to be run by the release pipeline only.`); process.exit(1); } +const auth = createActionAuth(); +const authentication = await auth(); + async function createRelease() { const octokit = new Octokit({ - auth: token + auth: authentication.token }); console.log('Starting release creation.'); - console.log(octokit); - let target_commitish; if (process.env.BUILD_SOURCEBRANCH) { target_commitish = process.env.BUILD_SOURCEBRANCH; diff --git a/.azure-pipelines/github-release/package-lock.json b/.azure-pipelines/github-release/package-lock.json index ab29955..748beb2 100644 --- a/.azure-pipelines/github-release/package-lock.json +++ b/.azure-pipelines/github-release/package-lock.json @@ -8,9 +8,19 @@ "version": "1.0.0", "license": "MIT", "dependencies": { + "@octokit/auth-action": "^1.3.2", "@octokit/rest": "^18.3.0" } }, + "node_modules/@octokit/auth-action": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-action/-/auth-action-1.3.2.tgz", + "integrity": "sha512-eCFGNq30e8ObTh6fwcmq8JRaGoputPQtPi9PTgbsEo+NPd5JrOoynI2bV7OpePRqgtATp1JRWC0y/3iXTB11ow==", + "dependencies": { + "@octokit/auth-token": "^2.4.0", + "@octokit/types": "^6.0.3" + } + }, "node_modules/@octokit/auth-token": { "version": "2.4.5", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz", @@ -178,6 +188,15 @@ } }, "dependencies": { + "@octokit/auth-action": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-action/-/auth-action-1.3.2.tgz", + "integrity": "sha512-eCFGNq30e8ObTh6fwcmq8JRaGoputPQtPi9PTgbsEo+NPd5JrOoynI2bV7OpePRqgtATp1JRWC0y/3iXTB11ow==", + "requires": { + "@octokit/auth-token": "^2.4.0", + "@octokit/types": "^6.0.3" + } + }, "@octokit/auth-token": { "version": "2.4.5", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz", diff --git a/.azure-pipelines/github-release/package.json b/.azure-pipelines/github-release/package.json index 0204776..959ec34 100644 --- a/.azure-pipelines/github-release/package.json +++ b/.azure-pipelines/github-release/package.json @@ -9,6 +9,7 @@ "author": "Microsoft", "license": "MIT", "dependencies": { + "@octokit/auth-action": "^1.3.2", "@octokit/rest": "^18.3.0" } }