Bump actions/github to 2.2.0 to support GHES (#72)

* Bumping actions/github to 2.2.0

* Husky commit correct node modules
This commit is contained in:
PJ Quirk
2020-05-15 09:52:23 -04:00
committed by GitHub
parent 04aa5dbc72
commit c5c9bd0f54
7791 changed files with 2209804 additions and 49075 deletions

View File

@@ -1,41 +1,52 @@
module.exports = authenticate
module.exports = authenticate;
const { Deprecation } = require('deprecation')
const once = require('once')
const { Deprecation } = require("deprecation");
const once = require("once");
const deprecateAuthenticate = once((log, deprecation) => log.warn(deprecation))
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.'))
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
state.auth = false;
return;
}
switch (options.type) {
case 'basic':
case "basic":
if (!options.username || !options.password) {
throw new Error('Basic authentication requires both a username and password to be set')
throw new Error(
"Basic authentication requires both a username and password to be set"
);
}
break
break;
case 'oauth':
case "oauth":
if (!options.token && !(options.key && options.secret)) {
throw new Error('OAuth2 authentication requires a token or key & secret to be set')
throw new Error(
"OAuth2 authentication requires a token or key & secret to be set"
);
}
break
break;
case 'token':
case 'app':
case "token":
case "app":
if (!options.token) {
throw new Error('Token authentication requires a token to be set')
throw new Error("Token authentication requires a token to be set");
}
break
break;
default:
throw new Error("Invalid authentication type, must be 'basic', 'oauth', 'token' or 'app'")
throw new Error(
"Invalid authentication type, must be 'basic', 'oauth', 'token' or 'app'"
);
}
state.auth = options
state.auth = options;
}