configure staging to set git config
This commit is contained in:
parent
c7bafc8ac3
commit
3b86b3cc1a
|
@ -11,6 +11,8 @@ set -o errtrace -o errexit -o nounset -o pipefail
|
|||
|
||||
bpmn_models_absolute_dir="$1"
|
||||
git_commit_message="$2"
|
||||
git_commit_username="$3"
|
||||
git_commit_email="$4"
|
||||
|
||||
if [[ -z "${2:-}" ]]; then
|
||||
>&2 echo "usage: $(basename "$0") [bpmn_models_absolute_dir] [git_commit_message]"
|
||||
|
@ -24,5 +26,11 @@ git add .
|
|||
if [ -z "$(git status --porcelain)" ]; then
|
||||
echo "No changes to commit"
|
||||
else
|
||||
if [[ -n "$git_commit_username" ]]; then
|
||||
git config --local user.name "$git_commit_username"
|
||||
fi
|
||||
if [[ -n "$git_commit_email" ]]; then
|
||||
git config --local user.email "$git_commit_email"
|
||||
fi
|
||||
git commit -m "$git_commit_message"
|
||||
fi
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
"""Staging."""
|
||||
GIT_COMMIT_ON_SAVE = True
|
||||
GIT_COMMIT_USERNAME = "staging"
|
||||
GIT_COMMIT_EMAIL = "staging@example.com"
|
||||
|
|
|
@ -43,8 +43,13 @@ class GitService:
|
|||
def commit(message: str) -> str:
|
||||
"""Commit."""
|
||||
bpmn_spec_absolute_dir = current_app.config["BPMN_SPEC_ABSOLUTE_DIR"]
|
||||
git_username = ''
|
||||
git_email = ''
|
||||
if current_app.config["GIT_COMMIT_USERNAME"] and current_app.config["GIT_COMMIT_EMAIL"]:
|
||||
git_username = current_app.config["GIT_COMMIT_USERNAME"]
|
||||
git_email = current_app.config["GIT_COMMIT_EMAIL"]
|
||||
shell_command = (
|
||||
f"./bin/git_commit_bpmn_models_repo '{bpmn_spec_absolute_dir}' '{message}'"
|
||||
f"./bin/git_commit_bpmn_models_repo '{bpmn_spec_absolute_dir}' '{message}' '{git_username}' '{git_email}'"
|
||||
)
|
||||
output = os.popen(shell_command).read() # noqa: S605
|
||||
return output
|
||||
|
|
Loading…
Reference in New Issue