Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
const payload = context.payload
const defaultBranch = payload.ref === 'refs/heads/' + payload.repository.default_branch

const config = await getConfig(context, 'settings.yml', {}, { arrayMerge: mergeArrayByName })
if (!defaultBranch) {
// Not the defualt branch, nothing to see here!
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure how to print with debug logs in probot :( but this should be a debug log

return;
}

const settingsModified = payload.commits.find(commit => {
return commit.added.includes(Settings.FILE_NAME) ||
commit.modified.includes(Settings.FILE_NAME)
const config = await getConfig(context, '/settings.yml', {}, {
arrayMerge: mergeArrayByName
})

if (defaultBranch && settingsModified) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the if for applying settings or not to the top, as if its not the case, there is no point on running the deepmerge

return Settings.sync(context.github, context.repo(), config)
}
return Settings.sync(context.github, context.repo(), config)
})
}