diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index ded7682d..aa8d45ea 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,9 +1,9 @@ +--- #------------------------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. #------------------------------------------------------------------------------------------------------------- -version: '3.7' services: # Update this to the name of the service you want to work with in your docker-compose.yml file dev: @@ -11,7 +11,7 @@ services: # to cause all processes to run as this user. Once present, you can also simply # use the "remoteUser" property in devcontainer.json if you just want VS Code and # its sub-processes (terminals, tasks, debugging) to execute as the user. On Linux, - # you may need to ensure the UID and GID of the container user you create matches your + # you may need to ensure the UID and GID of the container user you create matches your # local user. See https://aka.ms/vscode-remote/containers/non-root for details. # user: vscode @@ -23,13 +23,13 @@ services: # Uncomment if you want to expose any additional ports. The snippet below exposes port 3000. # ports: # - 3000:3000 - + volumes: # Update this to wherever you want VS Code to mount the folder of your project - .:/workspace:cached # Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-in-docker-compose for details. - # - /var/run/docker.sock:/var/run/docker.sock + # - /var/run/docker.sock:/var/run/docker.sock # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. # cap_add: @@ -39,4 +39,3 @@ services: # Overrides default command so things don't shut down after the process ends. command: /bin/sh -c "while sleep 1000; do :; done" - diff --git a/README.md b/README.md index 5637f985..36f4dba0 100644 --- a/README.md +++ b/README.md @@ -269,6 +269,7 @@ jobs: | gpg_private_key | `[optional]` set if you want to sign commits | `false` | | | gpg_passphrase | `[optional]` set if your optionial gpg private key has a passphrase | `false` | | | steps | `[optional] add the steps you want to execute within the action` | `false` | all steps will be executed | +| is_with_tags | `[optional]` set to `true` if tags should be synced | `false` | `false` | ### Action Outputs diff --git a/action.yml b/action.yml index 64be7956..9ab9ef56 100644 --- a/action.yml +++ b/action.yml @@ -72,6 +72,9 @@ inputs: description: "[optional] set if your private gpg key has a password" steps: description: "[optional] set the steps to execute within the action" + is_with_tags: + description: "[optional] set to true if tags should be synced" + default: "false" outputs: pr_branch: description: "The name of the PR branch" @@ -115,3 +118,4 @@ runs: GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} GPG_PASSPHRASE: ${{ inputs.gpg_passphrase }} STEPS: ${{ inputs.steps }} + IS_WITH_TAGS: ${{ inputs.is_with_tags }} diff --git a/src/sync_template.sh b/src/sync_template.sh index 1b6280e4..585a4aee 100755 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -42,6 +42,7 @@ if [[ -n "${SRC_SSH_PRIVATEKEY_ABS_PATH}" ]]; then export GIT_SSH_COMMAND="ssh -i ${SRC_SSH_PRIVATEKEY_ABS_PATH}" fi +IS_WITH_TAGS="${IS_WITH_TAGS:-"false"}" IS_FORCE_PUSH_PR="${IS_FORCE_PUSH_PR:-"false"}" IS_KEEP_BRANCH_ON_PR_CLEANUP="${IS_KEEP_BRANCH_ON_PR_CLEANUP:-"false"}" GIT_REMOTE_PULL_PARAMS="${GIT_REMOTE_PULL_PARAMS:---allow-unrelated-histories --squash --strategy=recursive -X theirs}" @@ -141,7 +142,6 @@ function check_if_commit_already_in_hist_graceful_exit() { warn "repository is up to date!" exit 0 fi - } ########################################## @@ -231,7 +231,7 @@ function pull_source_changes() { local source_repo=$1 local git_remote_pull_params=$2 - eval "git pull ${source_repo} ${git_remote_pull_params}" || pull_has_issues=true + eval "git pull ${source_repo} --tags ${git_remote_pull_params}" || pull_has_issues=true if [ "$pull_has_issues" == true ] ; then warn "There had been some git pull issues." @@ -280,18 +280,27 @@ function eventual_create_labels () { # Arguments: # branch # is_force +# is_with_tags ############################## function push () { info "push changes" local branch=$1 local is_force=$2 + local is_with_tags=$3 + + local additional_params=" " if [ "$is_force" == true ] ; then warn "forcing the push." - git push --force --set-upstream origin "${branch}" - else - git push --set-upstream origin "${branch}" + additional_params="${additional_params}--force " fi + + if [ "$is_with_tags" == true ] ; then + warn "include tags." + additional_params="${additional_params}--tags " + fi + + git push "${additional_params}"--set-upstream origin "${branch}" } #################################### @@ -456,7 +465,7 @@ function arr_push() { return 0 fi cmd_from_yml "prepush" - push "${PR_BRANCH}" "${IS_FORCE_PUSH_PR}" + push "${PR_BRANCH}" "${IS_FORCE_PUSH_PR}" "${IS_WITH_TAGS}" echo "::endgroup::" }