Add 'NO-PULL' feature (#150)
* feat(pull_strategy): add `NO-PULL` option * fix: add additional NO-PULL debug log
This commit is contained in:
@@ -39,9 +39,9 @@ Add a step like this to your workflow:
|
||||
# Default: 'Commit from GitHub Actions (name of the workflow)'
|
||||
message: 'Your commit message'
|
||||
|
||||
# The flag used on the pull strategy
|
||||
# The flag used on the pull strategy. Use NO-PULL to avoid the action pulling at all.
|
||||
# Default: '--no-rebase'
|
||||
pull_strategy: '--no-rebase or --no-ff or --rebase'
|
||||
pull_strategy: 'NO-PULL or --no-rebase or --no-ff or --rebase'
|
||||
|
||||
# Whether to push the commit and, if any, its tags to the repo. It can also be used to set the git push arguments (see the paragraph below for more info)
|
||||
# Default: true
|
||||
|
||||
@@ -25,7 +25,7 @@ inputs:
|
||||
description: The message for the commit
|
||||
required: false
|
||||
pull_strategy:
|
||||
description: The flag used on the pull strategy
|
||||
description: The flag used on the pull strategy. Use NO-PULL to avoid the action pulling at all.
|
||||
required: false
|
||||
default: '--no-rebase'
|
||||
push:
|
||||
|
||||
2
lib/index.js
generated
2
lib/index.js
generated
File diff suppressed because one or more lines are too long
26
src/main.ts
26
src/main.ts
@@ -50,15 +50,18 @@ console.log(`Running in ${baseDir}`)
|
||||
.checkout(getInput('branch'), undefined, log)
|
||||
.catch(() => git.checkoutLocalBranch(getInput('branch'), log))
|
||||
|
||||
info('> Pulling from remote...')
|
||||
await git.fetch(undefined, log).pull(
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
[getInput('pull_strategy')]: null
|
||||
},
|
||||
log
|
||||
)
|
||||
if (getInput('pull_strategy') == 'NO-PULL') info('> Not pulling from repo.')
|
||||
else {
|
||||
info('> Pulling from remote...')
|
||||
await git.fetch(undefined, log).pull(
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
[getInput('pull_strategy')]: null
|
||||
},
|
||||
log
|
||||
)
|
||||
}
|
||||
|
||||
info('> Re-staging files...')
|
||||
if (getInput('add')) await add({ ignoreErrors: true })
|
||||
@@ -257,6 +260,11 @@ async function checkInputs() {
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region pull_strategy
|
||||
if (getInput('pull_strategy') == 'NO-PULL')
|
||||
debug("NO-PULL found: won't pull from remote.")
|
||||
// #endregion
|
||||
|
||||
// #region push
|
||||
if (getInput('push')) {
|
||||
// It has to be either 'true', 'false', or any other string (use as arguments)
|
||||
|
||||
Reference in New Issue
Block a user