Skip to content

Commit 9acdb7d

Browse files
committed
Small refactor
1 parent 6d08b4f commit 9acdb7d

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/entrypoint.sh

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ echo "Running in $PWD."
66

77
# Set up .netrc file with GitHub credentials
88
git_setup() {
9-
cat <<- EOF > $HOME/.netrc
9+
cat <<-EOF >$HOME/.netrc
1010
machine github.com
1111
login $GITHUB_ACTOR
1212
password $GITHUB_TOKEN
@@ -16,16 +16,13 @@ git_setup() {
1616
password $GITHUB_TOKEN
1717
EOF
1818
chmod 600 $HOME/.netrc
19-
2019
git config --global user.email "$INPUT_AUTHOR_EMAIL"
2120
git config --global user.name "$INPUT_AUTHOR_NAME"
2221
}
2322

2423
add() {
25-
if $INPUT_FORCE
26-
then find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add -f $x; done
27-
else find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $x; done
28-
fi
24+
if $INPUT_FORCE; then f=-f; fi
25+
find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $f $x; done
2926
}
3027

3128
# This is needed to make the check work for untracked files
@@ -34,15 +31,13 @@ add
3431

3532
echo "Checking for uncommitted changes in the git working tree..."
3633
# This section only runs if there have been file changes
37-
if ! git diff --cached --exit-code
38-
then
34+
if ! git diff --cached --exit-code; then
3935
git_setup
4036

41-
git fetch
37+
git fetch
4238

4339
# Verify if the branch needs to be created
44-
if ! git rev-parse --verify --quiet "${GITHUB_REF:11}"
45-
then
40+
if ! git rev-parse --verify --quiet "${GITHUB_REF:11}"; then
4641
echo "Creating branch..."
4742
git branch "${GITHUB_REF:11}"
4843
fi

0 commit comments

Comments
 (0)