diff --git a/git_automation.sh b/git_automation.sh new file mode 100755 index 0000000..6f87243 --- /dev/null +++ b/git_automation.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +#Before running this script, make sure that you added an alias to your shell config file (~/.bashrc, ~/.zshrc, etc.) +#alias trigger_git='touch /tmp/please_update' +#Then run source ~/.zshrc to load the new alias + +#Variable to store the trigger file path +TRIGGER_FILE="/tmp/please_update" + +#The magic itself +echo "[INFO] Watching $TRIGGER_FILE..." +echo "[INFO] To trigger a git commit and push, run: trigger_git" +echo "PLEASE make sure that you have a good .gitignore file set up to avoid committing unwanted files." + +DEFAULT_COMMIT_MSG="Committed" +#Do not know if the runs forrever loop is the best way to do this but it works +while true; do + if [[ -f "$TRIGGER_FILE" ]]; then + rm -f "$TRIGGER_FILE" + + echo "[INFO] Triggered at $(date)" + + # For some reason this is buggy as hell and does not work as espected... + # read -rp "Enter commit message: " COMMIT_MSG