Skip to content

Commit 710c25e

Browse files
committed
fix: do not add dependabot files when config is falsy
1 parent 4624d9c commit 710c25e

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

lib/content/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const sharedRootAdd = (name) => ({
3737
// dependabot
3838
'.github/dependabot.yml': {
3939
file: 'dependabot.yml',
40+
filter: (p) => p.config.dependabot,
4041
clean: (p) => p.config.isRoot,
4142
// dependabot takes a single top level config file. this parser
4243
// will run for all configured packages and each one will have
@@ -48,6 +49,7 @@ const sharedRootAdd = (name) => ({
4849
},
4950
'.github/workflows/post-dependabot.yml': {
5051
file: 'post-dependabot.yml',
52+
filter: (p) => p.config.dependabot,
5153
},
5254
'.github/settings.yml': {
5355
file: 'settings.yml',

test/apply/dependabot.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const t = require('tap')
2+
const setup = require('../setup.js')
3+
4+
t.test('default dependabot', async (t) => {
5+
const s = await setup(t)
6+
await s.apply()
7+
8+
const dependabot = await s.readFile('.github/dependabot.yml')
9+
const postDependabot = await s.stat('.github/workflows/post-dependabot.yml')
10+
11+
t.match(dependabot, 'increase-if-necessary')
12+
t.ok(postDependabot)
13+
})
14+
15+
t.test('no dependabot', async (t) => {
16+
const s = await setup(t, {
17+
package: {
18+
templateOSS: {
19+
dependabot: false,
20+
},
21+
},
22+
})
23+
await s.apply()
24+
25+
const dependabot = await s.stat('.github/dependabot.yml').catch(() => false)
26+
const postDependabot = await s.stat('.github/workflows/post-dependabot.yml').catch(() => false)
27+
28+
t.equal(dependabot, false)
29+
t.equal(postDependabot, false)
30+
})

0 commit comments

Comments
 (0)