Remove GITHUB_TOKEN env var support (#674)

This commit is contained in:
Bjorn Lu
2026-06-30 00:20:57 +00:00
committed by GitHub
parent a35a66bd1e
commit 164652bdd6
2 changed files with 13 additions and 8 deletions
+8 -8
View File
@@ -3,16 +3,16 @@ import * as core from "@actions/core";
import { GitHub } from "./github.ts";
import readChangesetState from "./readChangesetState.ts";
import { runPublish, runVersion } from "./run.ts";
import { fileExists, getOptionalInput } from "./utils.ts";
import { fileExists, getOptionalInput, getRequiredInput } from "./utils.ts";
(async () => {
// 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");
return;
const githubToken = getRequiredInput("github-token");
if (process.env.GITHUB_TOKEN && process.env.GITHUB_TOKEN !== githubToken) {
throw new Error(
'The GITHUB_TOKEN environment variable is set and does not match the "github-token" input. ' +
'Please pass the custom GitHub token to the "github-token" input and ' +
"remove the GITHUB_TOKEN environment variable to avoid conflicts.",
);
}
// If the user needs to change the cwd, set `working-directory` in the step instead