Skip to content

Commit

Permalink
Merge pull request actions#1 from EndBug/better-paths
Browse files Browse the repository at this point in the history
Better paths
  • Loading branch information
EndBug authored Sep 18, 2019
2 parents 0f9f6c2 + 6a097ea commit 782b6b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Add a step like this to your workflow:
- `author_name` : the name of the user that will be displayed as the author of the commit
- `author_email` : the email of the user that will be displayed as the author of the commit
- `message` : the message for the commit
- `path` : the path to stage files from
- `path` : the path(s) to stage files from

### Environment variables:

Expand Down
10 changes: 7 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -eu

# Set up .netrc file with GitHub credentials
git_setup ( ) {
git_setup() {
cat <<- EOF > $HOME/.netrc
machine github.com
login $GITHUB_ACTOR
Expand All @@ -18,9 +18,13 @@ EOF
git config --global user.name "Add & Commit GitHub Action"
}

add() {
find $INPUT_PATH -name "*.*" | while read x; do git add $x; done
}

# This is needed to make the check work for untracked files
echo "Staging files in commit path..."
git add "${INPUT_PATH}"
add

echo "Checking for uncommitted changes in the git working tree..."
# This section only runs if there have been file changes
Expand All @@ -36,7 +40,7 @@ then
git checkout "${GITHUB_REF:11}"

echo "Adding files..."
git add "${INPUT_PATH}"
add

echo "Creating commit..."
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
Expand Down

0 comments on commit 782b6b1

Please sign in to comment.