Skip to content

Commit 52cd3e7

Browse files
committed
refactor: rename FILE_NAME to FILE_PATH for accuracy
1 parent 774b2e5 commit 52cd3e7

File tree

10 files changed

+19
-19
lines changed

10 files changed

+19
-19
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,11 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
270270
}
271271

272272
const settingsModified = payload.commits.find(commit => {
273-
return commit.added.includes(Settings.FILE_NAME) ||
274-
commit.modified.includes(Settings.FILE_NAME)
273+
return commit.added.includes(Settings.FILE_PATH) ||
274+
commit.modified.includes(Settings.FILE_PATH)
275275
})
276276
if (settingsModified) {
277-
robot.log.debug(`Changes in '${Settings.FILE_NAME}' detected, doing a full synch...`)
277+
robot.log.debug(`Changes in '${Settings.FILE_PATH}' detected, doing a full synch...`)
278278
return syncAllSettings(false, context)
279279
}
280280

@@ -292,7 +292,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
292292
}))
293293
}
294294

295-
robot.log.debug(`No changes in '${Settings.FILE_NAME}' detected, returning...`)
295+
robot.log.debug(`No changes in '${Settings.FILE_PATH}' detected, returning...`)
296296
})
297297

298298
robot.on('create', async context => {
@@ -597,10 +597,10 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
597597
const changes = await context.octokit.repos.compareCommitsWithBasehead(params)
598598
const files = changes.data.files.map(f => { return f.filename })
599599

600-
const settingsModified = files.includes(Settings.FILE_NAME)
600+
const settingsModified = files.includes(Settings.FILE_PATH)
601601

602602
if (settingsModified) {
603-
robot.log.debug(`Changes in '${Settings.FILE_NAME}' detected, doing a full synch...`)
603+
robot.log.debug(`Changes in '${Settings.FILE_PATH}' detected, doing a full synch...`)
604604
return syncAllSettings(true, context, context.repo(), pull_request.head.ref)
605605
}
606606

lib/settings.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ ${this.results.reduce((x, y) => {
791791
}
792792
)) {
793793
delete subOrgConfigs[key]
794-
}
794+
}
795795
}
796796
}
797797
return subOrgConfigs
@@ -862,7 +862,7 @@ ${this.results.reduce((x, y) => {
862862
if (this.nop) {
863863
//Remove nulls and undefined from the results
864864
const results = res.flat(3).filter(r => r)
865-
865+
866866
this.results = this.results.concat(results)
867867
}
868868
}
@@ -904,7 +904,7 @@ function prettify (obj) {
904904
return JSON.stringify(obj, null, 2).replaceAll('\n', '<br>').replaceAll(' ', '&nbsp;')
905905
}
906906

907-
Settings.FILE_NAME = path.posix.join(CONFIG_PATH, env.SETTINGS_FILE_PATH)
907+
Settings.FILE_PATH = path.posix.join(CONFIG_PATH, env.SETTINGS_FILE_PATH)
908908

909909
Settings.PLUGINS = {
910910
repository: require('./plugins/repository'),

test/integration/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function buildPushEvent () {
3838
payload: {
3939
ref: 'refs/heads/master',
4040
repository,
41-
commits: [{ modified: [settings.FILE_NAME], added: [] }]
41+
commits: [{ modified: [settings.FILE_PATH], added: [] }]
4242
}
4343
}
4444
}

test/integration/plugins/collaborators.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('collaborators plugin', function () {
2121
const configFile = Buffer.from(fs.readFileSync(pathToConfig, 'utf8'))
2222
const encodedConfig = configFile.toString('base64')
2323
githubScope
24-
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
24+
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_PATH}`)
2525
.reply(OK, { content: encodedConfig, name: 'settings.yml', type: 'file' })
2626
githubScope
2727
.get(`/repos/${repository.owner.name}/${repository.name}/collaborators?affiliation=direct`)

test/integration/plugins/milestones.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('milestones plugin', function () {
2121
const configFile = Buffer.from(fs.readFileSync(pathToConfig, 'utf8'))
2222
const encodedConfig = configFile.toString('base64')
2323
githubScope
24-
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
24+
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_PATH}`)
2525
.reply(OK, { content: encodedConfig, name: 'settings.yml', type: 'file' })
2626
githubScope
2727
.patch(`/repos/${repository.owner.name}/${repository.name}`)

test/integration/plugins/repository.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('repository plugin', function () {
2222
const config = yaml.safeLoad(configFile, 'utf8')
2323
const encodedConfig = configFile.toString('base64')
2424
githubScope
25-
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
25+
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_PATH}`)
2626
.reply(200, { content: encodedConfig, name: 'settings.yml', type: 'file' })
2727
githubScope
2828
.patch(`/repos/${repository.owner.name}/${repository.name}`, body => {

test/integration/plugins/teams.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('teams plugin', function () {
2525
const greenkeeperKeeperTeamId = any.integer()
2626
const formationTeamId = any.integer()
2727
githubScope
28-
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
28+
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_PATH}`)
2929
.reply(OK, { content: encodedConfig, name: 'settings.yml', type: 'file' })
3030
githubScope
3131
.get(`/repos/${repository.owner.name}/${repository.name}/teams`)

test/integration/triggers/push.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('push trigger', function () {
1919
payload: {
2020
ref: 'refs/heads/wip',
2121
repository,
22-
commits: [{ modified: [settings.FILE_NAME], added: [] }]
22+
commits: [{ modified: [settings.FILE_PATH], added: [] }]
2323
}
2424
})
2525
})

test/integration/triggers/repository-created.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ describe('repository.created trigger', function () {
1616

1717
it('does not apply configuration when the repository does not have a settings.yml', async () => {
1818
githubScope
19-
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
19+
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_PATH}`)
2020
.reply(NOT_FOUND, {
2121
message: 'Not Found',
2222
documentation_url: 'https://developer.github.com/v3/repos/contents/#get-contents'
2323
})
2424
githubScope
25-
.get(`/repos/${repository.owner.name}/.github/contents/${settings.FILE_NAME}`)
25+
.get(`/repos/${repository.owner.name}/.github/contents/${settings.FILE_PATH}`)
2626
.reply(NOT_FOUND, {
2727
message: 'Not Found',
2828
documentation_url: 'https://developer.github.com/v3/repos/contents/#get-contents'

test/integration/triggers/repository-edited.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ describe('repository.edited trigger', function () {
2626

2727
it('does not apply configuration when the repository does not have a settings.yml', async () => {
2828
githubScope
29-
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
29+
.get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_PATH}`)
3030
.reply(NOT_FOUND, {
3131
message: 'Not Found',
3232
documentation_url: 'https://developer.github.com/v3/repos/contents/#get-contents'
3333
})
3434
githubScope
35-
.get(`/repos/${repository.owner.name}/.github/contents/${settings.FILE_NAME}`)
35+
.get(`/repos/${repository.owner.name}/.github/contents/${settings.FILE_PATH}`)
3636
.reply(NOT_FOUND, {
3737
message: 'Not Found',
3838
documentation_url: 'https://developer.github.com/v3/repos/contents/#get-contents'

0 commit comments

Comments
 (0)