Skip to content

Commit f5554ef

Browse files
authored
Add 'NO-PULL' feature (#150)
* feat(pull_strategy): add `NO-PULL` option * fix: add additional NO-PULL debug log
1 parent 17b0915 commit f5554ef

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ Add a step like this to your workflow:
3939
# Default: 'Commit from GitHub Actions (name of the workflow)'
4040
message: 'Your commit message'
4141

42-
# The flag used on the pull strategy
42+
# The flag used on the pull strategy. Use NO-PULL to avoid the action pulling at all.
4343
# Default: '--no-rebase'
44-
pull_strategy: '--no-rebase or --no-ff or --rebase'
44+
pull_strategy: 'NO-PULL or --no-rebase or --no-ff or --rebase'
4545

4646
# 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)
4747
# Default: true

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ inputs:
2525
description: The message for the commit
2626
required: false
2727
pull_strategy:
28-
description: The flag used on the pull strategy
28+
description: The flag used on the pull strategy. Use NO-PULL to avoid the action pulling at all.
2929
required: false
3030
default: '--no-rebase'
3131
push:

lib/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,18 @@ console.log(`Running in ${baseDir}`)
5050
.checkout(getInput('branch'), undefined, log)
5151
.catch(() => git.checkoutLocalBranch(getInput('branch'), log))
5252

53-
info('> Pulling from remote...')
54-
await git.fetch(undefined, log).pull(
55-
undefined,
56-
undefined,
57-
{
58-
[getInput('pull_strategy')]: null
59-
},
60-
log
61-
)
53+
if (getInput('pull_strategy') == 'NO-PULL') info('> Not pulling from repo.')
54+
else {
55+
info('> Pulling from remote...')
56+
await git.fetch(undefined, log).pull(
57+
undefined,
58+
undefined,
59+
{
60+
[getInput('pull_strategy')]: null
61+
},
62+
log
63+
)
64+
}
6265

6366
info('> Re-staging files...')
6467
if (getInput('add')) await add({ ignoreErrors: true })
@@ -257,6 +260,11 @@ async function checkInputs() {
257260
}
258261
// #endregion
259262

263+
// #region pull_strategy
264+
if (getInput('pull_strategy') == 'NO-PULL')
265+
debug("NO-PULL found: won't pull from remote.")
266+
// #endregion
267+
260268
// #region push
261269
if (getInput('push')) {
262270
// It has to be either 'true', 'false', or any other string (use as arguments)

0 commit comments

Comments
 (0)