Skip to content

Commit

Permalink
Add only push tags support (#154)
Browse files Browse the repository at this point in the history
* feat: Add only push tags support
  • Loading branch information
ZPascal authored Jun 27, 2024
1 parent 2ebd2b2 commit f17d07c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ jobs:
| 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 }}`. Be aware, if you want to update the branch and the corresponding tag please use the `force` parameter instead of the `force_with_lease` option. |
| atomic | boolean | true | Determines if [atomic](https://git-scm.com/docs/git-push#Documentation/git-push.txt---no-atomic) push is used. |
| push_to_submodules | string | 'on-demand' | Determines if --recurse-submodules=<strategy> is used. The value defines the used strategy. |
| push_only_tags | boolean | false | Determines if the action should only push the tags, default false |
| tags | boolean | false | Determines if `--tags` is used. |
| directory | string | '.' | Directory to change to before pushing. |
| repository | string | '' | Repository name. <br /> Default or empty repository name represents <br /> current github repository. <br /> If you want to push to other repository, <br /> you should make a [personal access token](https://github.com/settings/tokens) <br /> and use it as the `github_token` input. |
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ inputs:
tags:
description: 'Determines if --tags is used'
required: false
push_only_tags:
description: 'Determines if the action should only push the tags, default false'
required: false
directory:
description: 'Directory to change to before pushing.'
required: false
Expand Down
3 changes: 3 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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_PUSH_ONLY_TAGS=${INPUT_PUSH_ONLY_TAGS:-false}
INPUT_DIRECTORY=${INPUT_DIRECTORY:-"."}
INPUT_PUSH_TO_SUBMODULES=${INPUT_PUSH_TO_SUBMODULES:-""}
_ATOMIC_OPTION=""
Expand Down Expand Up @@ -53,6 +54,8 @@ fi

if ! ${INPUT_FORCE_WITH_LEASE}; then
ADDITIONAL_PARAMETERS="${remote_repo} HEAD:${INPUT_BRANCH}"
elif ${INPUT_PUSH_ONLY_TAGS}; then
ADDITIONAL_PARAMETERS="${remote_repo}"
fi

if ${INPUT_FORCE_WITH_LEASE} && ${INPUT_TAGS}; then
Expand Down

0 comments on commit f17d07c

Please sign in to comment.