Skip to content

Commit 75f6a18

Browse files
committed
feat: initial version
1 parent 7bf2f31 commit 75f6a18

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/index.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { createTokenAuth } from "@octokit/auth-token";
2+
3+
export function createActionAuth() {
4+
if (!process.env.GITHUB_ACTION) {
5+
throw new Error(
6+
"[@octokit/auth-action] `GITHUB_ACTION` environment variable is not set. @octokit/auth-action is meant to be used in GitHub Actions only."
7+
);
8+
}
9+
10+
if (!process.env.GITHUB_TOKEN) {
11+
throw new Error(
12+
"[@octokit/auth-action] `GITHUB_TOKEN` environment variable is not set. See https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret"
13+
);
14+
}
15+
16+
return createTokenAuth(process.env.GITHUB_TOKEN);
17+
}

0 commit comments

Comments
 (0)