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

v1.0.0

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 add additional safe directories
πŸ”‘ Configures Git to use github.token when pushing/pulling from github.server_url
πŸ‘€ Sets up @github-actions[bot] as the default Git author

Usage

Git GitHub Actions

πŸš€ Here's what you want:

on: push
jobs:
  job:
    runs-on: ubuntu-latest
    steps:
      - uses: actions4git/setup-git@v1
      - run: git clone "https://github.com/$GITHUB_REPOSITORY.git" . # βœ…
      - run: npx --yes prettier --write .
      - run: git add --all
      - run: git commit --message 'Prettier' # βœ…
      - run: git push # βœ…

Inputs

⚠️ Support for choosing a git-version is not yet implemented. Contributions are welcome! ❀️

  • github-token: GitHub token to use for authentication when pulling and pushing to the GitHub instance defined by github-server-url. By default this uses github.token. Change this to a personal access token if you intend to do things that go beyond the scope of the current repository.

  • github-server-url: Server URL like https://github.example.org to use as the scope for the github-token. By default this uses github.server_url which is usually https://github.com. You shouldn't need to change this.

  • user: A Name Here <[email protected]> AiO user name & email string. This is a shortcut alternative to the independant user-name and user-email options that are also available. This defaults to @github-actions[bot]. You can set this to the special value github-actions to use the @github-actions[bot] user as the author, or the special me value to use the current github.actor user as the author.

  • user-name: The name of the user. Should be left unspecified if user is specified.

  • user-email: The email of the user. Should be left unspecified if user is specified.

  • safe-directory: A multiline list of globs to add to the Git safe-directory list. Defaults to the current directory ..

Outputs

TODO!

Development

Node.js

How do I test my changes?

Open a Draft Pull Request and some magic GitHub Actions will run to test the action.