mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Remove GITHUB_TOKEN env var support (#674)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@changesets/action": major
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove support for passing custom GitHub token through the GITHUB_TOKEN environment variable. It should be passed to the `github-token` input instead.
|
||||||
+8
-8
@@ -3,16 +3,16 @@ import * as core from "@actions/core";
|
|||||||
import { GitHub } from "./github.ts";
|
import { GitHub } from "./github.ts";
|
||||||
import readChangesetState from "./readChangesetState.ts";
|
import readChangesetState from "./readChangesetState.ts";
|
||||||
import { runPublish, runVersion } from "./run.ts";
|
import { runPublish, runVersion } from "./run.ts";
|
||||||
import { fileExists, getOptionalInput } from "./utils.ts";
|
import { fileExists, getOptionalInput, getRequiredInput } from "./utils.ts";
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
// to maintain compatibility with workflows created before github-token input was introduced
|
const githubToken = getRequiredInput("github-token");
|
||||||
// it's important to prefer the explicitly set GITHUB_TOKEN over the default token coming from github.token
|
if (process.env.GITHUB_TOKEN && process.env.GITHUB_TOKEN !== githubToken) {
|
||||||
let githubToken = process.env.GITHUB_TOKEN || core.getInput("github-token");
|
throw new Error(
|
||||||
|
'The GITHUB_TOKEN environment variable is set and does not match the "github-token" input. ' +
|
||||||
if (!githubToken) {
|
'Please pass the custom GitHub token to the "github-token" input and ' +
|
||||||
core.setFailed("Please add the GITHUB_TOKEN to the changesets action");
|
"remove the GITHUB_TOKEN environment variable to avoid conflicts.",
|
||||||
return;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user needs to change the cwd, set `working-directory` in the step instead
|
// If the user needs to change the cwd, set `working-directory` in the step instead
|
||||||
|
|||||||
Reference in New Issue
Block a user