Small refactor
This commit is contained in:
@@ -6,7 +6,7 @@ echo "Running in $PWD."
|
||||
|
||||
# Set up .netrc file with GitHub credentials
|
||||
git_setup() {
|
||||
cat <<- EOF > $HOME/.netrc
|
||||
cat <<-EOF >$HOME/.netrc
|
||||
machine github.com
|
||||
login $GITHUB_ACTOR
|
||||
password $GITHUB_TOKEN
|
||||
@@ -16,16 +16,13 @@ git_setup() {
|
||||
password $GITHUB_TOKEN
|
||||
EOF
|
||||
chmod 600 $HOME/.netrc
|
||||
|
||||
git config --global user.email "$INPUT_AUTHOR_EMAIL"
|
||||
git config --global user.name "$INPUT_AUTHOR_NAME"
|
||||
}
|
||||
|
||||
add() {
|
||||
if $INPUT_FORCE
|
||||
then find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add -f $x; done
|
||||
else find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $x; done
|
||||
fi
|
||||
if $INPUT_FORCE; then f=-f; fi
|
||||
find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $f $x; done
|
||||
}
|
||||
|
||||
# This is needed to make the check work for untracked files
|
||||
@@ -34,15 +31,13 @@ add
|
||||
|
||||
echo "Checking for uncommitted changes in the git working tree..."
|
||||
# This section only runs if there have been file changes
|
||||
if ! git diff --cached --exit-code
|
||||
then
|
||||
if ! git diff --cached --exit-code; then
|
||||
git_setup
|
||||
|
||||
git fetch
|
||||
git fetch
|
||||
|
||||
# Verify if the branch needs to be created
|
||||
if ! git rev-parse --verify --quiet "${GITHUB_REF:11}"
|
||||
then
|
||||
if ! git rev-parse --verify --quiet "${GITHUB_REF:11}"; then
|
||||
echo "Creating branch..."
|
||||
git branch "${GITHUB_REF:11}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user