@@ -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_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
|
- `author_email` : the email of the user that will be displayed as the author of the commit
|
||||||
- `message` : the message for 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:
|
### Environment variables:
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# Set up .netrc file with GitHub credentials
|
# Set up .netrc file with GitHub credentials
|
||||||
git_setup ( ) {
|
git_setup() {
|
||||||
cat <<- EOF > $HOME/.netrc
|
cat <<- EOF > $HOME/.netrc
|
||||||
machine github.com
|
machine github.com
|
||||||
login $GITHUB_ACTOR
|
login $GITHUB_ACTOR
|
||||||
@@ -18,9 +18,13 @@ EOF
|
|||||||
git config --global user.name "Add & Commit GitHub Action"
|
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
|
# This is needed to make the check work for untracked files
|
||||||
echo "Staging files in commit path..."
|
echo "Staging files in commit path..."
|
||||||
git add "${INPUT_PATH}"
|
add
|
||||||
|
|
||||||
echo "Checking for uncommitted changes in the git working tree..."
|
echo "Checking for uncommitted changes in the git working tree..."
|
||||||
# This section only runs if there have been file changes
|
# This section only runs if there have been file changes
|
||||||
@@ -36,7 +40,7 @@ then
|
|||||||
git checkout "${GITHUB_REF:11}"
|
git checkout "${GITHUB_REF:11}"
|
||||||
|
|
||||||
echo "Adding files..."
|
echo "Adding files..."
|
||||||
git add "${INPUT_PATH}"
|
add
|
||||||
|
|
||||||
echo "Creating commit..."
|
echo "Creating commit..."
|
||||||
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
|
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
|
||||||
|
|||||||
Reference in New Issue
Block a user