Removes the need for COMMIT_NAME and COMMIT_EMAIL (#25)

* Actor Changes

* Default Action Name/Email

* Update entrypoint.sh

* Update entrypoint.sh
This commit is contained in:
James Ives 2019-09-22 08:31:11 -04:00 committed by GitHub
parent ffe5eb539e
commit 60732f6ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -54,8 +54,6 @@ Below you'll find a description of what each option does.
| `BASE_BRANCH` | The base branch of your repository which you'd like to checkout prior to deploying. This defaults to `master`. | `env` | **No** | | `BASE_BRANCH` | The base branch of your repository which you'd like to checkout prior to deploying. This defaults to `master`. | `env` | **No** |
| `BUILD_SCRIPT` | If you require a build script to compile your code prior to pushing it you can add the script here. The Docker container which powers the action runs Node which means `npm` commands are valid. If you're using a static site generator such as Jekyll I'd suggest compiling the code prior to pushing it to your base branch. | `env` | **No** | | `BUILD_SCRIPT` | If you require a build script to compile your code prior to pushing it you can add the script here. The Docker container which powers the action runs Node which means `npm` commands are valid. If you're using a static site generator such as Jekyll I'd suggest compiling the code prior to pushing it to your base branch. | `env` | **No** |
| `CNAME` | If you're using a [custom domain](https://help.github.com/en/articles/using-a-custom-domain-with-github-pages), you will need to add the domain name to the `CNAME` environment variable. If you don't do this GitHub will wipe out your domain configuration after each deploy. This value will look something like this: `jives.dev`. | `env` | **No** | | `CNAME` | If you're using a [custom domain](https://help.github.com/en/articles/using-a-custom-domain-with-github-pages), you will need to add the domain name to the `CNAME` environment variable. If you don't do this GitHub will wipe out your domain configuration after each deploy. This value will look something like this: `jives.dev`. | `env` | **No** |
| `COMMIT_EMAIL` | Used to sign the commit, this should be your email. If not provided it will default to `username@users.noreply.github.com`. | `env` | **No** |
| `COMMIT_NAME` | Used to sign the commit, this should be your name. If not provided it will default to your username. | `env` | **No** |
With the action correctly configured you should see the workflow trigger the deployment under the configured conditions. With the action correctly configured you should see the workflow trigger the deployment under the configured conditions.

View File

@ -25,20 +25,26 @@ case "$FOLDER" in /*|./*)
exit 1 exit 1
esac esac
# Installs Git and jq.
apt-get update && \
apt-get install -y git && \
apt-get install -y jq && \
# Gets the commit email/name if it exists in the push event payload.
COMMIT_EMAIL=`jq '.pusher.email' ${GITHUB_EVENT_PATH}`
COMMIT_NAME=`jq '.pusher.name' ${GITHUB_EVENT_PATH}`
# If the commit email/name is not found in the event payload then it falls back to the actor.
if [ -z "$COMMIT_EMAIL" ] if [ -z "$COMMIT_EMAIL" ]
then then
COMMIT_EMAIL="${GITHUB_ACTOR}@users.noreply.github.com" COMMIT_EMAIL="${GITHUB_ACTOR:-github-pages-deploy-action}@users.noreply.github.com"
fi fi
if [ -z "$COMMIT_NAME" ] if [ -z "$COMMIT_NAME" ]
then then
COMMIT_NAME="${GITHUB_ACTOR}" COMMIT_NAME="${GITHUB_ACTOR:-GitHub Pages Deploy Action}"
fi fi
# Installs Git.
apt-get update && \
apt-get install -y git && \
# Directs the action to the the Github workspace. # Directs the action to the the Github workspace.
cd $GITHUB_WORKSPACE && \ cd $GITHUB_WORKSPACE && \