diff --git a/.github/workflows/create-github-release.yml b/.github/workflows/create-github-release.yml index 630d1a112a..8ef3f10f6a 100644 --- a/.github/workflows/create-github-release.yml +++ b/.github/workflows/create-github-release.yml @@ -31,4 +31,6 @@ jobs: # TODO/Note: This will only create a Draft release, which the maintainer can see and publish. # If the Draft release looks good, modify the step to go ahead publish the release. (By adding the third CLI argument.) - name: Create release on GitHub - run: node scripts/create-github-release.js ${{ steps.get_version.outputs.TAG_NAME }} ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }} + run: node scripts/create-github-release.js ${{ steps.get_version.outputs.TAG_NAME }} + env: + GITHUB_TOKEN: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }} diff --git a/scripts/create-github-release.js b/scripts/create-github-release.js index 4dfe8f9dc3..a9bfb9f5b3 100644 --- a/scripts/create-github-release.js +++ b/scripts/create-github-release.js @@ -24,16 +24,18 @@ * * Example: * + * Set GITHUB_TOKEN environment variable. + * * (Dry Run mode, will create a DRAFT release, but will not publish it.) * (Draft releases are visible to maintainers and do not notify users.) - * $ node scripts/get-release-description v0.4.1 + * $ node scripts/get-release-description v0.4.1 * * This will open the git tree at this tag https://github.com/backstage/backstage/tree/v0.4.1 * It will identify https://github.com/backstage/backstage/pull/3668 as the responsible changeset PR. * And will use everything in the PR description under "Releases" section. * * (Production or GitHub Actions Mode) - * $ node scripts/get-release-description v0.4.1 1 + * $ node scripts/get-release-description v0.4.1 true * * This will do the same steps as above, and will publish the Release with the description. */ @@ -41,7 +43,7 @@ const { Octokit } = require('@octokit/rest'); // See Examples above to learn about these command line arguments. -const [TAG_NAME, GITHUB_TOKEN, BOOL_CREATE_RELEASE] = process.argv.slice(2); +const [TAG_NAME, BOOL_CREATE_RELEASE] = process.argv.slice(2); if (!BOOL_CREATE_RELEASE) { console.log( @@ -55,7 +57,7 @@ const EXPECTED_COMMIT_MESSAGE = /^Merge pull request #(?[0-9]+) from b // Initialize a GitHub client const octokit = new Octokit({ - auth: GITHUB_TOKEN, + auth: process.env.GITHUB_TOKEN, }); // Get the message of the commit responsible for a tag