Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function authenticate({ gitHubToken, gitLabToken }) {
octokit = Octokit()
octokit.authenticate({ type: 'token', token: gitHubToken })
gitlab = new Gitlab({ personaltoken: gitLabToken })
}
function init(tokens) {
github = githubInit(tokens.githubToken)
gitlab = new Gitlab({ personaltoken: tokens.gitlabToken })
getTwitterFollowers = twitterFollowersCount({
consumer_key: tokens.twitterConsumerKey,
consumer_secret: tokens.twitterConsumerSecret,
access_token_key: tokens.twitterAccessTokenKey,
access_token_secret: tokens.twitterAccessTokenSecret,
})
}
module.exports = async (opts, path, content, message) => {
const gitlab = new Gitlab({
host: opts.instance,
token: opts.token
});
content = Buffer.from(content).toString('base64');
const response = await gitlab.RepositoryFiles.edit(
opts.projectId,
path,
opts.branch,
content,
message, {
encoding: 'base64'
}
).catch(error => {
throw new Error(error);
});
function getGitLabClient(token) {
const client = new Gitlab({
token,
});
return client;
}
constructor(public readonly repoMetadata: RepoMetaData, public readonly repoCredentials: GitLabAPICredentials) {
this.fetch = fetch
this.api = new Gitlab(repoCredentials)
this.hostURL = repoCredentials.host
}
module.exports = async (opts, path, content, message) => {
const gitlab = new Gitlab({
host: opts.instance,
token: opts.token
});
content = Buffer.from(content).toString('base64');
const response = await gitlab.RepositoryFiles.create(
opts.projectId,
path,
opts.branch,
content,
message, {
encoding: 'base64'
}
).catch(error => {
throw new Error(error);
});