Thursday, November 30, 2023
HomeSoftware EngineeringEasy methods to use Git Commit in GitHub Actions

Easy methods to use Git Commit in GitHub Actions


When you’ve tried to make use of git commit in GitHub Actions earlier than, you could have come throughout the next error messages:

Writer identification unknown
*** Please inform me who you're.

Run
  git config --global person.electronic mail "[email protected]"
  git config --global person.title "Your Identify"

to set your account's default identification.
Omit --global to set the identification solely on this repository.

deadly: empty ident title
    (for <[email protected]>) not allowed
Writer identification unknown

This could simply be fastened by doing the next:

Operating Git Commit straight in GitHub Actions

title: Commit date to grasp
on: push
jobs:
  date:
    runs-on: ubuntu-latest
    steps:
      - title: checkout
        makes use of: actions/[email protected]
      - title: save present date
        run: date > date.log
      - title: setup git config
        run: |
          git config person.title "GitHub Actions Bot"
          git config person.electronic mail "<>"
      - title: commit
        run: |
          git add date.log
          git commit -m "new commit message"
          git push origin grasp

Discover the addition of the git config objects:

git config person.title "GitHub Actions Bot"
git config person.electronic mail "<>"

An instance the place python calls git commit internally

title: Cron
on:
  schedule:
    - cron: '* * * * *'
jobs:
  construct:
    runs-on: ubuntu-latest
    steps:
      - makes use of: actions/[email protected]
      - title: setup python
        makes use of: actions/[email protected]
        with:
          python-version: 3.8
      - title: Run a one-line script
        run: |
          git config person.title "GitHub Actions Bot"
          git config person.electronic mail "<>"
          python run.py
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments