Giter Site home page Giter Site logo

monikajassova / ghcommit-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from planetscale/ghcommit-action

0.0 0.0 0.0 92 KB

GitHub Action to commit files to a git branch using the ghcommit utility

License: Apache License 2.0

Shell 89.31% Makefile 4.08% Dockerfile 6.61%

ghcommit-action's Introduction

ghcommit-action

A GitHub Action to detect changed files during a Workflow run and to commit and push them back to the GitHub repository using the ghcommit utility.

The advantage of using ghcommit is that the commits will be signed by GitHub's GPG key and show as Verified. This is important for repositories that require signed commits.

The plugin is inspired by stefanzweifel/git-auto-commit-action and uses some of the same input parameters. We expect to emulate more of its parameters over time and PRs providing similar functionality will be considered.

Usage

The plugin is currently implemented as a Docker style plugin. It must be run on a Linux host, eg: ubuntu-latest.

name: fmt

on:
  # NOTE: Need to run on a PR so that the ${{ github.head_ref }} (branch) is non-null
  pull_request:
    types:
      - opened
      - synchronize
      - reopened

jobs:
  fmt-code:
    runs-on: ubuntu-latest

    permissions:
      # Give the default GITHUB_TOKEN write permission to commit and push the
      # added or changed files to the repository.
      contents: write

    steps:
      - uses: actions/checkout@v4
      # Include the pull request ref in the checkout action to prevent merge commit
      # https://github.com/actions/checkout?tab=readme-ov-file#checkout-pull-request-head-commit-instead-of-merge-commit
        with:
          ref: ${{ github.event.pull_request.head.sha }}

      # Run steps that make changes to the local repo here.

      # Commit all changed files back to the repository
      - uses: planetscale/[email protected]
        with:
          commit_message: "๐Ÿค– fmt"
          repo: ${{ github.repository }}
          branch: ${{ github.head_ref || github.ref_name }}
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

NOTE: These examples may not show the latest version. Check the GitHub Releases page to see the latest version tag

Example showing all options:

      - uses: planetscale/[email protected]
        with:
          commit_message: "๐Ÿค– fmt"
          repo: ${{ github.repository }}
          branch: ${{ github.head_ref || github.ref_name }}
          empty: true
          file_pattern: '*.txt *.md *.json *.hcl'
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

See action.yaml for current list of supported inputs.

Releasing

Releases (version tags) are generated automatically on all successful main branch builds. This project uses autotag to automate this process.

Semver (vMajor.Minor.Patch) is used for versioning and releases. By default, autotag will bump the patch version on a successful main build, eg: v1.0.0 -> v1.0.1.

To bump the major or minor release instead, include [major] or [minor] in the commit message. Refer to the autotag docs for more details.

ghcommit-action's People

Contributors

joemiller avatar dependabot[bot] avatar felix-renovate[bot] avatar dctrwatson avatar sinjo avatar faun avatar chris3ware avatar frouioui avatar monikajassova avatar nickvanw 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.