This commit is contained in:
+2
-34
@@ -2,25 +2,10 @@
|
||||
|
||||
A reusable Gitea Action that downloads and sets up the Trivy binary for vulnerability scanning.
|
||||
|
||||
## Features
|
||||
|
||||
- 🚀 Easy setup with minimal configuration
|
||||
- 🔧 Configurable Trivy version and architecture
|
||||
- ✅ Input validation and error handling
|
||||
- 🔄 Compatible with Gitea Actions and GitHub Actions
|
||||
- ⚡ **Smart caching** - Uses native GitHub Actions cache with proper cache-hit detection
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```yaml
|
||||
- name: Setup Trivy
|
||||
uses: your-username/trivy-actions@main/setup-trivy
|
||||
```
|
||||
|
||||
### Advanced Usage
|
||||
|
||||
```yaml
|
||||
- name: Setup Trivy
|
||||
uses: your-username/trivy-actions@main/setup-trivy
|
||||
@@ -41,36 +26,19 @@ jobs:
|
||||
- ubuntu-latest
|
||||
- linux_amd64
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Trivy
|
||||
uses: your-username/trivy-actions@main/setup-trivy
|
||||
with:
|
||||
version: "v0.66.0"
|
||||
architecture: "amd64"
|
||||
|
||||
- name: Run Trivy vulnerability scanner
|
||||
- name: Scan for vulnerabilities
|
||||
run: trivy fs .
|
||||
```
|
||||
|
||||
## Action Steps
|
||||
|
||||
The action is structured into logical steps for better maintainability:
|
||||
|
||||
1. **Cache Trivy binary** - Uses `actions/cache@v4` to restore cached binary
|
||||
2. **Validate inputs** - Validates version and architecture parameters
|
||||
3. **Download and install Trivy** - Only runs on cache miss, downloads and installs binary
|
||||
4. **Add Trivy to PATH** - Ensures Trivy is available in subsequent steps
|
||||
5. **Verify Trivy installation** - Confirms installation and shows version
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
| -------------- | ----------------------------------------- | -------- | --------- |
|
||||
| `version` | Trivy version to download (e.g., v0.66.0) | No | `v0.66.0` |
|
||||
| `architecture` | System architecture (amd64, arm64) | No | `amd64` |
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
- **Linux**: amd64, arm64
|
||||
|
||||
Reference in New Issue
Block a user