Skip to content

Commit e602665

Browse files
authored
ci: add workflow to bump trivy (#245)
* ci: add workflow to bump trivy * update trivy version in tests * dispatch event workflow_dispatch * use ORG_REPO_TOKEN secret
1 parent 3dd517d commit e602665

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Diff for: .github/workflows/bump-trivy.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Bump trivy
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
trivy_version:
7+
required: true
8+
type: string
9+
description: the trivy version
10+
11+
run-name: Bump trivy to v${{ inputs.trivy_version }}
12+
13+
jobs:
14+
bump:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Update Trivy versions
19+
run: |
20+
sed -r -i "s/ghcr.io\/aquasecurity\/trivy:[0-9]+\.[0-9]+\.[0-9]+/ghcr.io\/aquasecurity\/trivy:${{ inputs.trivy_version }}/" Dockerfile
21+
sed -r -i "s/TRIVY_VERSION: [0-9]+\.[0-9]+\.[0-9]+/TRIVY_VERSION: ${{ inputs.trivy_version }}/" .github/workflows/build.yaml
22+
find test/data -type f -name '*.test' | xargs sed -r -i 's/"version": "[0-9]+\.[0-9]+\.[0-9]+"/"version": "${{ inputs.trivy_version }}"/'
23+
24+
- name: Create PR
25+
id: create-pr
26+
uses: peter-evans/create-pull-request@v5
27+
with:
28+
token: ${{ secrets.ORG_REPO_TOKEN }}
29+
title: "chore(deps): Update trivy to v${{ inputs.trivy_version }}"
30+
commit-message: "chore(deps): Update trivy to v${{ inputs.trivy_version }}"
31+
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
32+
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
33+
branch-suffix: timestamp
34+
branch: bump-trivy
35+
delete-branch: true
36+
37+
- name: Check outputs
38+
run: |
39+
echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}"
40+
echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}"

0 commit comments

Comments
 (0)