mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Automatically use the GitHub-provided token to allow most users to avoid explicit GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} configuration (#564)
This commit is contained in:
+5
-1
@@ -10,7 +10,9 @@ import { fileExists } from "./utils.ts";
|
||||
const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
||||
|
||||
(async () => {
|
||||
let githubToken = process.env.GITHUB_TOKEN;
|
||||
// to maintain compatibility with workflows created before github-token input was introduced
|
||||
// it's important to prefer the explicitly set GITHUB_TOKEN over the default token coming from github.token
|
||||
let githubToken = process.env.GITHUB_TOKEN || core.getInput("github-token");
|
||||
|
||||
if (!githubToken) {
|
||||
core.setFailed("Please add the GITHUB_TOKEN to the changesets action");
|
||||
@@ -114,6 +116,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
||||
|
||||
const result = await runPublish({
|
||||
script: publishScript,
|
||||
githubToken,
|
||||
git,
|
||||
octokit,
|
||||
createGithubReleases: core.getBooleanInput("createGithubReleases"),
|
||||
@@ -136,6 +139,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
||||
const octokit = setupOctokit(githubToken);
|
||||
const { pullRequestNumber } = await runVersion({
|
||||
script: getOptionalInput("version"),
|
||||
githubToken,
|
||||
git,
|
||||
octokit,
|
||||
prTitle: getOptionalInput("title"),
|
||||
|
||||
Reference in New Issue
Block a user