feat: Add push to submodules support (#155)
This commit is contained in:
committed by
GitHub
parent
c8e9166762
commit
e0ae067286
23
README.md
23
README.md
@ -219,17 +219,18 @@ jobs:
|
|||||||
|
|
||||||
### Inputs
|
### Inputs
|
||||||
|
|
||||||
| name | value | default | description |
|
| name | value | default | description |
|
||||||
|------------------| ----- | ------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|--------------------|---------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| github_token | string | `${{ github.token }}` | [GITHUB_TOKEN](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow) <br /> or a repo scoped <br /> [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). |
|
| github_token | string | `${{ github.token }}` | [GITHUB_TOKEN](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow) <br /> or a repo scoped <br /> [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). |
|
||||||
| ssh | boolean | false | Determines if ssh/ Deploy Keys is used. |
|
| ssh | boolean | false | Determines if ssh/ Deploy Keys is used. |
|
||||||
| branch | string | (default) | Destination branch to push changes. <br /> Can be passed in using `${{ github.ref }}`. |
|
| branch | string | (default) | Destination branch to push changes. <br /> Can be passed in using `${{ github.ref }}`. |
|
||||||
| force | boolean | false | Determines if force push is used. |
|
| 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 }}`. |
|
| 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. |
|
| 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. |
|
| push_to_submodules | string | 'on-demand' | Determines if --recurse-submodules=<strategy> is used. The value defines the used strategy. |
|
||||||
| directory | string | '.' | Directory to change to before pushing. |
|
| tags | boolean | false | Determines if `--tags` is used. |
|
||||||
| 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. |
|
| 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. |
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
@ -32,6 +32,10 @@ inputs:
|
|||||||
atomic:
|
atomic:
|
||||||
description: 'Determines if atomic push is used, default true'
|
description: 'Determines if atomic push is used, default true'
|
||||||
required: false
|
required: false
|
||||||
|
push_to_submodules:
|
||||||
|
description: 'Determines if --recurse-submodules=<strategy> is used. The value defines the used strategy'
|
||||||
|
required: false
|
||||||
|
default: 'on-demand'
|
||||||
tags:
|
tags:
|
||||||
description: 'Determines if --tags is used'
|
description: 'Determines if --tags is used'
|
||||||
required: false
|
required: false
|
||||||
|
7
start.sh
7
start.sh
@ -7,6 +7,7 @@ INPUT_FORCE_WITH_LEASE=${INPUT_FORCE_WITH_LEASE:-false}
|
|||||||
INPUT_SSH=${INPUT_SSH:-false}
|
INPUT_SSH=${INPUT_SSH:-false}
|
||||||
INPUT_TAGS=${INPUT_TAGS:-false}
|
INPUT_TAGS=${INPUT_TAGS:-false}
|
||||||
INPUT_DIRECTORY=${INPUT_DIRECTORY:-'.'}
|
INPUT_DIRECTORY=${INPUT_DIRECTORY:-'.'}
|
||||||
|
INPUT_PUSH_TO_SUBMODULES=${INPUT_PUSH_TO_SUBMODULES:-''}
|
||||||
_ATOMIC_OPTION=''
|
_ATOMIC_OPTION=''
|
||||||
_FORCE_OPTION=''
|
_FORCE_OPTION=''
|
||||||
REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY}
|
REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY}
|
||||||
@ -38,6 +39,10 @@ if ${INPUT_TAGS}; then
|
|||||||
_TAGS='--tags'
|
_TAGS='--tags'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "${INPUT_PUSH_TO_SUBMODULES}" ]; then
|
||||||
|
_INPUT_PUSH_TO_SUBMODULES="--recurse-submodules=${INPUT_PUSH_TO_SUBMODULES}"
|
||||||
|
fi
|
||||||
|
|
||||||
cd ${INPUT_DIRECTORY}
|
cd ${INPUT_DIRECTORY}
|
||||||
|
|
||||||
if ${INPUT_SSH}; then
|
if ${INPUT_SSH}; then
|
||||||
@ -52,4 +57,4 @@ if ! ${INPUT_FORCE_WITH_LEASE}; then
|
|||||||
ADDITIONAL_PARAMETERS="${remote_repo} HEAD:${INPUT_BRANCH}"
|
ADDITIONAL_PARAMETERS="${remote_repo} HEAD:${INPUT_BRANCH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git push $ADDITIONAL_PARAMETERS $_ATOMIC_OPTION --follow-tags $_FORCE_OPTION $_TAGS;
|
git push $ADDITIONAL_PARAMETERS $_INPUT_PUSH_TO_SUBMODULES $_ATOMIC_OPTION --follow-tags $_FORCE_OPTION $_TAGS;
|
||||||
|
Reference in New Issue
Block a user