https://github.com/shoothzj/go-mod-check-action
https://github.com/shoothzj/go-mod-check-action
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/shoothzj/go-mod-check-action
- Owner: shoothzj
- License: apache-2.0
- Created: 2023-04-06T11:18:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-12T07:29:12.000Z (about 1 year ago)
- Last Synced: 2024-11-14T03:56:08.805Z (about 1 year ago)
- Language: Go
- Size: 16.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
## Requirements
- Go 1.17+
## 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:
```yaml
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](LICENSE).