diff --git a/README.md b/README.md index 5fbd420..eb9b57a 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ jobs: | branch | string | (default) | Destination branch to push changes.
Can be passed in using `${{ github.ref }}`. | | force | boolean | false | Determines if force push is used. | | force_with_lease | boolean | false | Determines if force-with-lease push is used. Please specify the corresponding branch inside `ref` section of the checkout action e.g. `ref: ${{ github.head_ref }}`. | +| atomic | boolean | true | Determines if [atomic](https://git-scm.com/docs/git-push#Documentation/git-push.txt---no-atomic) push is used. | | tags | boolean | false | Determines if `--tags` is used. | | directory | string | '.' | Directory to change to before pushing. | | repository | string | '' | Repository name.
Default or empty repository name represents
current github repository.
If you want to push to other repository,
you should make a [personal access token](https://github.com/settings/tokens)
and use it as the `github_token` input. | diff --git a/action.yml b/action.yml index fc15686..d3af2ce 100644 --- a/action.yml +++ b/action.yml @@ -29,6 +29,9 @@ inputs: force_with_lease: description: 'Determines if force-with-lease push is used' required: false + atomic: + description: 'Determines if atomic push is used, default true' + required: false tags: description: 'Determines if --tags is used' required: false diff --git a/start.sh b/start.sh index bf8c48a..b3c0394 100755 --- a/start.sh +++ b/start.sh @@ -1,11 +1,13 @@ #!/bin/sh set -e +INPUT_ATOMIC=${INPUT_ATOMIC:-true} INPUT_FORCE=${INPUT_FORCE:-false} INPUT_FORCE_WITH_LEASE=${INPUT_FORCE_WITH_LEASE:-false} INPUT_SSH=${INPUT_SSH:-false} INPUT_TAGS=${INPUT_TAGS:-false} INPUT_DIRECTORY=${INPUT_DIRECTORY:-'.'} +_ATOMIC_OPTION='' _FORCE_OPTION='' REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY} @@ -20,6 +22,10 @@ if ${INPUT_FORCE} && ${INPUT_FORCE_WITH_LEASE}; then exit 1; fi +if ${INPUT_ATOMIC}; then + _ATOMIC_OPTION='--atomic' +fi + if ${INPUT_FORCE}; then _FORCE_OPTION='--force' fi @@ -43,8 +49,8 @@ fi git config --local --add safe.directory ${INPUT_DIRECTORY} if ${INPUT_FORCE_WITH_LEASE}; then - git push --atomic --follow-tags $_FORCE_OPTION $_TAGS; + git push $_ATOMIC_OPTION --follow-tags $_FORCE_OPTION $_TAGS; else - git push "${remote_repo}" HEAD:${INPUT_BRANCH} --atomic --verbose --follow-tags $_FORCE_OPTION $_TAGS; + git push "${remote_repo}" HEAD:${INPUT_BRANCH} $_ATOMIC_OPTION --verbose --follow-tags $_FORCE_OPTION $_TAGS; fi