Code Monkey home page Code Monkey logo

validate-go-generate's Introduction

Validate Go Generate GitHub Action

This GitHub Action, named "Validate Go Generate," is designed to help validate and manage Go code generation in a GitHub repository. The action performs tasks such as removing generated files, regenerating them using go generate, and optionally committing the changes. Below is a detailed explanation of the inputs, steps, and usage.

Usage

Inputs

  1. root_path (default: ./):

    • Description: The application's root path.
    • Default: ./
  2. commit (default: false):

    • Description: A flag indicating whether to commit the changes.
    • Default: false
  3. commit-message (default: 'fix: generate files'):

    • Description: The commit message to be used if commits are enabled.
    • Default: 'fix: generate files'
  4. commit-actor (default: 'github_actions'):

    • Description: The actor or user to be associated with the commit.
    • Default: 'github_actions'

Runs

The GitHub Action consists of the following steps:

  1. Remove generated files:

    • Description: Removes files generated by Go code generation based on a specific comment pattern.
  2. Generate files:

    • Description: Invokes the go generate command to regenerate files as per the Go code generation instructions.
  3. Commit changes (conditional):

    • Description: Commits the changes if the commit input is set to true.
    • Default Commit Message: 'fix: generate files'
    • Default Commit Actor: 'github_actions'
  4. Check diff (conditional):

    • Description: Checks for differences in the working directory after the changes.
    • Conditional: Only runs if commit is set to false.

Example YAML

name: Validate Go Generate

on:
  pull_request:

jobs:
  validate_go_generate:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4
      with:
        ref: ${{ github.event.pull_request.head.ref }}

    - name: Run Validate Go Generate
      uses: path/to/[email protected]
      with:
        root_path: './'
        commit: 'true'
        commit-message: 'fix: updated generated files'
        commit-actor: 'github_actions'

validate-go-generate's People

Contributors

meriy100 avatar dependabot[bot] avatar

Stargazers

ccoVeille avatar

Watchers

Takashi Kiyama avatar Takuma J Miyake avatar Kazuaki Shibuya avatar  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.