* 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:
Peter Evans 2022-03-23 14:22:01 +09:00 committed by GitHub
parent 0e8dfbd57d
commit d6d5519d05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 291 additions and 185 deletions

View file

@ -119,21 +119,26 @@ export async function createOrUpdateBranch(
const tempBranch = uuidv4()
await git.checkout(tempBranch, 'HEAD')
// Commit any uncommitted changes
if (await git.isDirty(true)) {
if (await git.isDirty(true, addPaths)) {
core.info('Uncommitted changes found. Adding a commit.')
for (const path of addPaths) {
await git.exec(['add', path], true)
const aopts = ['add']
if (addPaths.length > 0) {
aopts.push(...['--', ...addPaths])
} else {
aopts.push('-A')
}
const params = ['-m', commitMessage]
await git.exec(aopts, true)
const popts = ['-m', commitMessage]
if (signoff) {
params.push('--signoff')
popts.push('--signoff')
}
await git.commit(params)
// Remove uncommitted tracked and untracked changes
await git.exec(['reset', '--hard'])
await git.exec(['clean', '-f'])
await git.commit(popts)
}
// Remove uncommitted tracked and untracked changes
await git.exec(['reset', '--hard'])
await git.exec(['clean', '-f', '-d'])
// Perform fetch and reset the working base
// Commits made during the workflow will be removed
if (workingBaseType == WorkingBaseType.Branch) {