28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
var authToken = require('@octokit/auth-token');
|
|
|
|
const createActionAuth = 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.");
|
|
}
|
|
|
|
const definitions = [process.env.GITHUB_TOKEN, process.env.INPUT_GITHUB_TOKEN, process.env.INPUT_TOKEN].filter(Boolean);
|
|
|
|
if (definitions.length === 0) {
|
|
throw new Error("[@octokit/auth-action] `GITHUB_TOKEN` variable is not set. It must be set on either `env:` or `with:`. See https://github.com/octokit/auth-action.js#createactionauth");
|
|
}
|
|
|
|
if (definitions.length > 1) {
|
|
throw new Error("[@octokit/auth-action] The token variable is specified more than once. Use either `with.token`, `with.GITHUB_TOKEN`, or `env.GITHUB_TOKEN`. See https://github.com/octokit/auth-action.js#createactionauth");
|
|
}
|
|
|
|
const token = definitions.pop();
|
|
return authToken.createTokenAuth(token);
|
|
};
|
|
|
|
exports.createActionAuth = createActionAuth;
|
|
//# sourceMappingURL=index.js.map
|