mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-06-29 14:46:03 +00:00
node_modules
This commit is contained in:
parent
5e3f23f92c
commit
806116bda4
734 changed files with 224451 additions and 0 deletions
52
node_modules/@octokit/rest/plugins/authentication-deprecated/authenticate.js
generated
vendored
Normal file
52
node_modules/@octokit/rest/plugins/authentication-deprecated/authenticate.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
module.exports = authenticate;
|
||||
|
||||
const { Deprecation } = require("deprecation");
|
||||
const once = require("once");
|
||||
|
||||
const deprecateAuthenticate = once((log, deprecation) => log.warn(deprecation));
|
||||
|
||||
function authenticate(state, options) {
|
||||
deprecateAuthenticate(
|
||||
state.octokit.log,
|
||||
new Deprecation(
|
||||
'[@octokit/rest] octokit.authenticate() is deprecated. Use "auth" constructor option instead.'
|
||||
)
|
||||
);
|
||||
|
||||
if (!options) {
|
||||
state.auth = false;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (options.type) {
|
||||
case "basic":
|
||||
if (!options.username || !options.password) {
|
||||
throw new Error(
|
||||
"Basic authentication requires both a username and password to be set"
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case "oauth":
|
||||
if (!options.token && !(options.key && options.secret)) {
|
||||
throw new Error(
|
||||
"OAuth2 authentication requires a token or key & secret to be set"
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case "token":
|
||||
case "app":
|
||||
if (!options.token) {
|
||||
throw new Error("Token authentication requires a token to be set");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error(
|
||||
"Invalid authentication type, must be 'basic', 'oauth', 'token' or 'app'"
|
||||
);
|
||||
}
|
||||
|
||||
state.auth = options;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue