Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shoothzj/go-mod-check-action
https://github.com/shoothzj/go-mod-check-action
Last synced: 10 days 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 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-10T08:35:45.000Z (about 1 month ago)
- Last Synced: 2024-10-17T03:17:07.358Z (about 1 month ago)
- Language: Go
- Size: 12.7 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 Checkon:
push:
branches:
- main
pull_request:
branches:
- mainjobs:
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).