mirror of
https://github.com/status-im/actions-gh-pages.git
synced 2025-02-03 08:44:31 +00:00
feat: Add username and useremail options (#67)
* feat: Add username and useremail options * docs: Add Git username and email section Close #66
This commit is contained in:
parent
bdedb4ed2b
commit
0252bbee4d
18
README.md
18
README.md
@ -71,6 +71,7 @@ Do you want to skip the docker build step? OK, the script mode is available.
|
||||
- [⭐️ Keeping existing files](#%EF%B8%8F-keeping-existing-files)
|
||||
- [⭐️ Deploy to external repository](#%EF%B8%8F-deploy-to-external-repository)
|
||||
- [⭐️ Force orphan](#%EF%B8%8F-force-orphan)
|
||||
- [⭐️ Set Git username and email](#%EF%B8%8F-set-git-username-and-email)
|
||||
- [⭐️ Script mode](#%EF%B8%8F-script-mode)
|
||||
- [Tips and FAQ](#tips-and-faq)
|
||||
- [⭐️ Use the latest and specific release](#%EF%B8%8F-use-the-latest-and-specific-release)
|
||||
@ -311,6 +312,23 @@ This allows you to make your publish branch with only the latest commit.
|
||||
forceOrphan: true
|
||||
```
|
||||
|
||||
### ⭐️ Set Git username and email
|
||||
|
||||
Set custom `git config user.name` and `git config user.email`.
|
||||
A commit is always created with the same user.
|
||||
|
||||
```yaml
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v2
|
||||
env:
|
||||
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
PUBLISH_BRANCH: gh-pages
|
||||
PUBLISH_DIR: ./public
|
||||
with:
|
||||
username: "iris"
|
||||
useremail: "iris@peaceiris.com"
|
||||
```
|
||||
|
||||
### ⭐️ Script mode
|
||||
|
||||
From `v2.5.0`, we can run this action as a shell script.
|
||||
|
@ -20,3 +20,9 @@ inputs:
|
||||
description: 'Keep only the latest commit on a GitHub Pages branch'
|
||||
required: false
|
||||
default: 'false'
|
||||
username:
|
||||
description: 'Set Git user.name'
|
||||
required: false
|
||||
useremail:
|
||||
description: 'Set Git user.email'
|
||||
required: false
|
||||
|
@ -102,8 +102,16 @@ else
|
||||
fi
|
||||
|
||||
# push to publishing branch
|
||||
git config user.name "${GITHUB_ACTOR}"
|
||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
if [[ -n "${INPUT_USERNAME}" ]]; then
|
||||
git config user.name "${INPUT_USERNAME}"
|
||||
else
|
||||
git config user.name "${GITHUB_ACTOR}"
|
||||
fi
|
||||
if [[ -n "${INPUT_USEREMAIL}" ]]; then
|
||||
git config user.email "${INPUT_USEREMAIL}"
|
||||
else
|
||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
fi
|
||||
git remote rm origin || true
|
||||
git remote add origin "${remote_repo}"
|
||||
git add --all
|
||||
|
Loading…
x
Reference in New Issue
Block a user