mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
v4 (#1099)
* feat: update action runtime to node 16 * feat: allow add-paths to resolve to no changes * docs: update readme * chore: update package lock * chore: bump dependency * ci: add dependabot workflow * docs: update action versions
This commit is contained in:
parent
0e8dfbd57d
commit
d6d5519d05
15 changed files with 291 additions and 185 deletions
|
@ -155,17 +155,22 @@ export class GitCommandManager {
|
|||
return output.exitCode === 1
|
||||
}
|
||||
|
||||
async isDirty(untracked: boolean): Promise<boolean> {
|
||||
async isDirty(untracked: boolean, pathspec?: string[]): Promise<boolean> {
|
||||
const pathspecArgs = pathspec ? ['--', ...pathspec] : []
|
||||
// Check untracked changes
|
||||
if (untracked && (await this.status(['--porcelain', '-unormal']))) {
|
||||
const sargs = ['--porcelain', '-unormal']
|
||||
sargs.push(...pathspecArgs)
|
||||
if (untracked && (await this.status(sargs))) {
|
||||
return true
|
||||
}
|
||||
// Check working index changes
|
||||
if (await this.hasDiff()) {
|
||||
if (await this.hasDiff(pathspecArgs)) {
|
||||
return true
|
||||
}
|
||||
// Check staged changes
|
||||
if (await this.hasDiff(['--staged'])) {
|
||||
const dargs = ['--staged']
|
||||
dargs.push(...pathspecArgs)
|
||||
if (await this.hasDiff(dargs)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue