setup-rust-action/node_modules/@octokit/rest/plugins/authentication/index.js
Héctor Ramón Jiménez 7f8c3a27a4 Track node_modules
2019-08-15 19:37:37 +02:00

22 lines
484 B
JavaScript

module.exports = authenticationPlugin
const beforeRequest = require('./before-request')
const requestError = require('./request-error')
const validate = require('./validate')
function authenticationPlugin (octokit, options) {
if (!options.auth) {
return
}
validate(options.auth)
const state = {
octokit,
auth: options.auth
}
octokit.hook.before('request', beforeRequest.bind(null, state))
octokit.hook.error('request', requestError.bind(null, state))
}