mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
22 lines
492 B
JavaScript
22 lines
492 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));
|
||
|
}
|