Skip to content

Commit

Permalink
feat: initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Aug 16, 2019
1 parent 7bf2f31 commit 75f6a18
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { createTokenAuth } from "@octokit/auth-token";

export function createActionAuth() {
if (!process.env.GITHUB_ACTION) {
throw new Error(
"[@octokit/auth-action] `GITHUB_ACTION` environment variable is not set. @octokit/auth-action is meant to be used in GitHub Actions only."
);
}

if (!process.env.GITHUB_TOKEN) {
throw new Error(
"[@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"
);
}

return createTokenAuth(process.env.GITHUB_TOKEN);
}

0 comments on commit 75f6a18

Please sign in to comment.