Sets Git config options
user.name
anduser.email
to enable commit operations.
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rindeal/action-git-config-user@v1
- run: |
touch foo
git commit -am "Commits work and are attributed to Github Actions bot"
-
name
- The
user.name
value forgit config
.
- The
-
email
- The
user.email
value forgit config
.
- The
-
scope
- The scope of
git config
. Will be converted into a<file-option>
as described in theGIT-CONFIG(1)
manpage. - Default is
local
. - Options are:
local
global
worktree
file
- The scope of
-
scope-file-path
- Path to a file for
--file
scope ofgit config
. - Eg.
~/.my-custom-gitconfig
.
- Path to a file for
-
working-directory
- Working Directory. Default is a standard
$GITHUB_WORKSPACE
.
- Working Directory. Default is a standard
-
name
- The
user.name
applied togit config
.
- The
-
email
- The
user.email
applied togit config
.
- The
-
scope
- The
scope
applied togit config
.
- The
-
scope-file-path
- The
scope-file-path
applied togit config
.
- The
uses: rindeal/action-git-config-user@v1
with:
name: 'Your Name'
email: 'your-email@example.com'
scope: 'local'
working-directory: './path/to/your/project'
In this example, the user.name and user.email are set for the local scope of the Git configuration in the specified working directory.
The default name
and email
are set to:
GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
-
The
name
is set to "GitHub Actions" because this action is designed to be run in the context of GitHub Actions. It's a way to indicate that the commits are made by an automated process, not a human. -
The
email
is set to "41898282+github-actions[bot]@users.noreply.github.com", because it's the email address associated with the GitHub Actions bot, which will link the bot's official page.
These defaults ensure that the commits made by this action are correctly attributed to GitHub Actions in the commit history. However, you can override these defaults with your own name and email if you want the commits to be attributed to a specific user.
Authored by Jan Chren (rindeal). Licensed under GPL-3.0-only. This license permits copying, modification, and distribution of the software. The same license must be applied to all software versions. Fork and modify as needed, but respect the license.