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
+5
View File
@@ -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
View File
@@ -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