mirror of
https://github.com/ad-m/github-push-action.git
synced 2025-06-08 06:27:02 +09:00
Issue 191 (#197)
* feat: Adjust the start.sh and add .gitignore * docs: Update the documentation
This commit is contained in:
parent
9870d48124
commit
2ebd2b29bb
3 changed files with 27 additions and 22 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/.idea/
|
24
README.md
24
README.md
|
@ -272,18 +272,18 @@ jobs:
|
|||
|
||||
### Inputs
|
||||
|
||||
| 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). |
|
||||
| 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 }}`. |
|
||||
| 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. |
|
||||
| push_to_submodules | string | 'on-demand' | Determines if --recurse-submodules=<strategy> is used. The value defines the used strategy. |
|
||||
| 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. |
|
||||
| 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). |
|
||||
| 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 }}`. |
|
||||
| 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 }}`. 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. |
|
||||
| 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. |
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
|
24
start.sh
24
start.sh
|
@ -6,37 +6,37 @@ 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:-'.'}
|
||||
INPUT_PUSH_TO_SUBMODULES=${INPUT_PUSH_TO_SUBMODULES:-''}
|
||||
_ATOMIC_OPTION=''
|
||||
_FORCE_OPTION=''
|
||||
INPUT_DIRECTORY=${INPUT_DIRECTORY:-"."}
|
||||
INPUT_PUSH_TO_SUBMODULES=${INPUT_PUSH_TO_SUBMODULES:-""}
|
||||
_ATOMIC_OPTION=""
|
||||
_FORCE_OPTION=""
|
||||
REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY}
|
||||
|
||||
echo "Push to branch $INPUT_BRANCH";
|
||||
[ -z "${INPUT_GITHUB_TOKEN}" ] && {
|
||||
echo 'Missing input "github_token: ${{ secrets.GITHUB_TOKEN }}".';
|
||||
echo "Missing input 'github_token: ${{ secrets.GITHUB_TOKEN }}'.";
|
||||
exit 1;
|
||||
};
|
||||
|
||||
if ${INPUT_FORCE} && ${INPUT_FORCE_WITH_LEASE}; then
|
||||
echo 'Please, specify only force or force_with_lease and not both.';
|
||||
echo "Please, specify only force or force_with_lease and not both.";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ${INPUT_ATOMIC}; then
|
||||
_ATOMIC_OPTION='--atomic'
|
||||
_ATOMIC_OPTION="--atomic"
|
||||
fi
|
||||
|
||||
if ${INPUT_FORCE}; then
|
||||
_FORCE_OPTION='--force'
|
||||
_FORCE_OPTION="--force"
|
||||
fi
|
||||
|
||||
if ${INPUT_FORCE_WITH_LEASE}; then
|
||||
_FORCE_OPTION='--force-with-lease'
|
||||
_FORCE_OPTION="--force-with-lease"
|
||||
fi
|
||||
|
||||
if ${INPUT_TAGS}; then
|
||||
_TAGS='--tags'
|
||||
_TAGS="--tags"
|
||||
fi
|
||||
|
||||
if [ -n "${INPUT_PUSH_TO_SUBMODULES}" ]; then
|
||||
|
@ -55,4 +55,8 @@ if ! ${INPUT_FORCE_WITH_LEASE}; then
|
|||
ADDITIONAL_PARAMETERS="${remote_repo} HEAD:${INPUT_BRANCH}"
|
||||
fi
|
||||
|
||||
if ${INPUT_FORCE_WITH_LEASE} && ${INPUT_TAGS}; then
|
||||
_ATOMIC_OPTION=""
|
||||
fi
|
||||
|
||||
git push $ADDITIONAL_PARAMETERS $_INPUT_PUSH_TO_SUBMODULES $_ATOMIC_OPTION --follow-tags $_FORCE_OPTION $_TAGS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue