fix: don't push files to git if ignored (#5334)
* fix: don't push files to git if ignored * tweak: change gitPath var to gitFilePath * fix: "update" instead of "create" of updated file Co-authored-by: Jacob Parker <blocckba5her@gmail.com> Co-authored-by: DevBlocky <16978528+DevBlocky@users.noreply.github.com>
This commit is contained in:
parent
7f1988cd6a
commit
e3d94f7177
@ -289,10 +289,13 @@ module.exports = {
|
|||||||
const filePath = path.join(this.repoPath, fileName)
|
const filePath = path.join(this.repoPath, fileName)
|
||||||
await fs.outputFile(filePath, page.injectMetadata(), 'utf8')
|
await fs.outputFile(filePath, page.injectMetadata(), 'utf8')
|
||||||
|
|
||||||
await this.git.add(`./${fileName}`)
|
const gitFilePath = `./${fileName}`
|
||||||
|
if ((await this.git.checkIgnore(gitFilePath)).length === 0) {
|
||||||
|
await this.git.add(gitFilePath)
|
||||||
await this.git.commit(`docs: create ${page.path}`, fileName, {
|
await this.git.commit(`docs: create ${page.path}`, fileName, {
|
||||||
'--author': `"${page.authorName} <${page.authorEmail}>"`
|
'--author': `"${page.authorName} <${page.authorEmail}>"`
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* UPDATE
|
* UPDATE
|
||||||
@ -308,10 +311,13 @@ module.exports = {
|
|||||||
const filePath = path.join(this.repoPath, fileName)
|
const filePath = path.join(this.repoPath, fileName)
|
||||||
await fs.outputFile(filePath, page.injectMetadata(), 'utf8')
|
await fs.outputFile(filePath, page.injectMetadata(), 'utf8')
|
||||||
|
|
||||||
await this.git.add(`./${fileName}`)
|
const gitFilePath = `./${fileName}`
|
||||||
|
if ((await this.git.checkIgnore(gitFilePath)).length === 0) {
|
||||||
|
await this.git.add(gitFilePath)
|
||||||
await this.git.commit(`docs: update ${page.path}`, fileName, {
|
await this.git.commit(`docs: update ${page.path}`, fileName, {
|
||||||
'--author': `"${page.authorName} <${page.authorEmail}>"`
|
'--author': `"${page.authorName} <${page.authorEmail}>"`
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* DELETE
|
* DELETE
|
||||||
@ -325,10 +331,13 @@ module.exports = {
|
|||||||
fileName = `${page.localeCode}/${fileName}`
|
fileName = `${page.localeCode}/${fileName}`
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.git.rm(`./${fileName}`)
|
const gitFilePath = `./${fileName}`
|
||||||
|
if ((await this.git.checkIgnore(gitFilePath)).length === 0) {
|
||||||
|
await this.git.rm(gitFilePath)
|
||||||
await this.git.commit(`docs: delete ${page.path}`, fileName, {
|
await this.git.commit(`docs: delete ${page.path}`, fileName, {
|
||||||
'--author': `"${page.authorName} <${page.authorEmail}>"`
|
'--author': `"${page.authorName} <${page.authorEmail}>"`
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* RENAME
|
* RENAME
|
||||||
|
Loading…
Reference in New Issue
Block a user