Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} catch (e) {
logger.info(
"Organisation configuration not found, resolving .clabot URL at project level"
);
orgConfig = await getReadmeUrl(webhook);
}
logger.info(
`Obtaining .clabot configuration file from ${
orgConfig.download_url.split("?")[0]
}`
);
const config = await getFile(orgConfig);
if (!is.json(config)) {
throw new Error("The .clabot file is not valid JSON");
}
// merge with default config options
const botConfig = Object.assign({}, defaultConfig, config);
logger.info("Obtaining the list of commits for the pull request");
const commits = await getCommits(pullRequestUrl);
logger.info(
`Total Commits: ${commits.length}, checking CLA status for committers`
);
// PRs include the head sha, for comments we have to determine this from the commit history
let headSha;
if (webhook.pull_request) {
Flowa.prototype._setDefaultType = function(task) {
var self = this;
// Is not a compound task, nothing to do
if (!is.json(task)) {
return;
}
// The type is not defined
if (typeof task.type == 'undefined') {
task.type = this._defaultRunnerType;
}
// Foreach task
_.forIn(task, function(task) {
self._setDefaultType(task);
});
};
return items.every(item => {
if (is.string(item)) {
if (this.ok(item)) {
return true
} else {
throw Error(`No environment configuration for var "${item}"`)
}
} else if (is.json(item)) {
const key = Object.keys(item)[0]
const type = item[key].type
const validator = item[key].ok
if (type && !validType(type)) {
throw Error(`Invalid expected type "${type}"`)
} else {
const kit = getKit(type)
const val = kit.getter(key)
const result = kit.validator(val)
if (!result) {
throw Error(`Unexpected result for key="${key}". It may not exist or may not be a valid "${type}"`)
}
if (validator && is.function(validator)) {
const valid = validator(val)
export const isOptJson = (item: any) => {
const msg = getMsg(item, 'need to be object or null')
return compose(
msg,
some(is.null, is.undefined, is.json)
)
}
export const isOptCallback = (item: any) => {
prev[next] = getter(next, obj[next])
return prev
}, {})
)
const arrReducer = (keys, getter) => {
const arr = items.map(key => getter(key))
return arr.reduce((prev, next, index) => {
prev[keys[index]] = arr[index]
return prev
}, {})
}
if (is.array(items)) {
return arrReducer(items, this.get)
} else if (is.json(items)) {
return objReducer(items, this.get)
} else {
throw Error(`Invalid arg ${items}`)
}
},
Flowa.prototype._isCompoundTask = function(taskName) {
return is.json(this._tasks[taskName]);
};