Giter Club home page Giter Club logo

git-commit-push's Introduction

Git Commit & Push action

Action test on Ubuntu Action test on MacOS Action test on Windows

GitHub Action to commit & push changes made in workflows :octocat:

Screenshot 2021-10-21 at 15 40 50

Note: This action is supported on all runners operating systems (ubuntu, macos, windows)


📚 Usage

Public workflows that use this action.

⚠️ Requirements

  • The actions/checkout is mandatory to use this action, as it will be necessary to access the repository files.

1️⃣ Minimal: Commit and Push with default parameters

    steps:
      - uses: actions/checkout@v4
      # [...] --> steps with actions or commands updating repository files
      - uses: GuillaumeFalourd/[email protected]

2️⃣ Full: Commit and Push with customized parameters

    steps:
      - uses: actions/checkout@v4
      # [...] --> steps with actions or commands updating repository files
      - uses: GuillaumeFalourd/[email protected]
        with:
          email: ${{ github.actor }}@users.noreply.github.com
          name: ${{ github.actor }}
          commit_message: your_message
          target_branch: target_branch_name
          files: file1 file2 directory1 directory2/file3
          remote_repository: https://github.com/owner/another_repository
          access_token: ${{ github.token }}
          force: true
          empty: true
          tags: true

Known Issue

When pushing to the same repository, the workflow may return the following error using the action:

remote: Permission to <owner>/<repository>.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/<owner>/<repository>/': The requested URL returned error: 403

This can be resolved by adding persist-credentials: false and fetch-depth: 0 to the workflow configurations when using the actions/checkout.

     - uses: actions/checkout@v4
       with:
          persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of the personal access token.
          fetch-depth: 0  # otherwise, there would be errors pushing refs to the destination repository.
     - uses: GuillaumeFalourd/[email protected]
       with:
          email: ${{ github.actor }}@users.noreply.github.com
          name: ${{ github.actor }}
          commit_message: your_message
          target_branch: target_branch_name
          files: file1 file2 directory1 directory2/file3
          remote_repository: https://github.com/owner/another_repository
          access_token: ${{ github.token }}
          force: true
          empty: true
          tags: true

▶️ Action Inputs

Field Mandatory Default Value Observation
email NO ${{ github.actor }}@users.noreply.github.com Github user email
e.g: [email protected]
name NO ${{ github.actor }} Github username
e.g: octocat
commit_message NO Commit performed using Push and Commit action Commit message
target_branch NO ${{ github.ref }} Branch to push the changes back
files NO . Files to add separated by space
e.g: file1 file2 directory1 directory2/file3
remote_repository NO origin Repository url to push the code
access_token NO ${{ github.token }} Personal Access Token is necessary if push to another repository
force NO 0 Whether to perform force push
empty NO 0 Whether to allow empty commit
tags NO 0 Whether to use --tags

🤝 Contributing

Guidelines

🏅 Licensed

☞ This repository uses the Apache License 2.0

git-commit-push's People

Contributors

guillaumefalourd avatar jarva avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.