Skip to content

shoothzj/go-mod-check-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-mod-check-action

This GitHub Action checks if your go.mod and go.sum files are properly updated and optionally prevents indirect dependency updates.

Features

  1. Runs go mod tidy to check if go.mod and go.sum files have any changes. If there are changes, the action fails.
  2. If prohibitIndirectDepUpdate is set to true, the action will first remove indirect dependency blocks (excluding replace blocks) from go.mod, then run go mod tidy, and check if the go.mod and go.sum files have any changes compared to the initial state. If there are changes, the action fails.

Usage

To use this action in your project, follow these steps:

  1. Add a new workflow file or edit an existing one in your project's .github/workflows directory. For example, create or edit .github/workflows/go-mod-check.yml.
  2. Add the following content to the file:
name: Go Mod Check

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  go-mod-check:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v2
      - name: Run Go Mod Check Action
        uses: Shoothzj/go-mod-check-action@main
        with:
          prohibitIndirectDepUpdate: 'true'

Now, the go-mod-check-action will run on every push/pr to your project, ensuring that the go.mod and go.sum files are properly updated and preventing indirect dependency updates if required.

Configuration

You can configure the action using the following input parameters:

Parameter Description Required Default
prohibitIndirectDepUpdate If set to true, the action will prohibit indirect dependency updates. No false

License

This project is licensed under the Apache 2.0 License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages