Skip to content

Commit 164652b

Browse files
authored
Remove GITHUB_TOKEN env var support (#674)
1 parent a35a66b commit 164652b

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

.changeset/fiery-toes-vanish.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/action": major
3+
---
4+
5+
Remove support for passing custom GitHub token through the GITHUB_TOKEN environment variable. It should be passed to the `github-token` input instead.

src/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ import * as core from "@actions/core";
33
import { GitHub } from "./github.ts";
44
import readChangesetState from "./readChangesetState.ts";
55
import { runPublish, runVersion } from "./run.ts";
6-
import { fileExists, getOptionalInput } from "./utils.ts";
6+
import { fileExists, getOptionalInput, getRequiredInput } from "./utils.ts";
77

88
(async () => {
9-
// to maintain compatibility with workflows created before github-token input was introduced
10-
// it's important to prefer the explicitly set GITHUB_TOKEN over the default token coming from github.token
11-
let githubToken = process.env.GITHUB_TOKEN || core.getInput("github-token");
12-
13-
if (!githubToken) {
14-
core.setFailed("Please add the GITHUB_TOKEN to the changesets action");
15-
return;
9+
const githubToken = getRequiredInput("github-token");
10+
if (process.env.GITHUB_TOKEN && process.env.GITHUB_TOKEN !== githubToken) {
11+
throw new Error(
12+
'The GITHUB_TOKEN environment variable is set and does not match the "github-token" input. ' +
13+
'Please pass the custom GitHub token to the "github-token" input and ' +
14+
"remove the GITHUB_TOKEN environment variable to avoid conflicts.",
15+
);
1616
}
1717

1818
// If the user needs to change the cwd, set `working-directory` in the step instead

0 commit comments

Comments
 (0)