Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
settings

GitHub Action

Setup Git environment

v0.1.0 Pre-release

Setup Git environment

settings

Setup Git environment

๐Ÿ”ถ Configure Git for GitHub Actions

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Setup Git environment

uses: actions4git/[email protected]

Learn more about this action in actions4git/setup-git

Choose a version

Setup Git environment

๐Ÿ”ถ Install and configure Git for GitHub Actions

- run: git commit --message 'Automated changes'
# โŒ Please tell me who you are.
# Run
#   git config --global user.email "[email protected]"
#   git config --global user.name "Your Name"
- uses: actions4git/setup-git@v1
- run: git commit --message 'Automated changes'
# โœ… Committed 3 files

๐Ÿ”ข Lets you pick a specific version of Git to use (if needed)
โšก Defaults to using the system version of Git
๐Ÿ“‚ Lets you add additional [safe directories]
๐Ÿ”‘ Properly configures Git to use the github.token by default
๐Ÿ‘ค Sets up @github-actions[bot] as the default Git author

Usage

GitHub Actions

on: push
jobs:
  job:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions4git/setup-git@v1
      - run: npx --yes prettier --write .
      - run: git add --all
      - run: git commit --message 'Prettier'
      - run: git push