Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fiery-toes-vanish.md
Original file line numberDiff line numberDiff line change
@@ -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.
16 changes: 8 additions & 8 deletions src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -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) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have this "they have to match if both are specified" rule - shouldn't we kinda also enforce that in other subactions that use github-token?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is more for compat to push migration, so eventually in the next major we can remove this and we don't have to mind about GITHUB_TOKEN anymore.

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
Expand Down