File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 trivy_version :
77 required : true
88 type : string
9- description : the trivy version
9+ description : ' The Trivy version in x.x.x format '
1010
1111run-name : Bump trivy to v${{ inputs.trivy_version }}
1212
@@ -15,11 +15,12 @@ jobs:
1515 runs-on : ubuntu-latest
1616 steps :
1717 - uses : actions/checkout@v4
18+
19+ - name : Set new version from input
20+ run : echo "NEW_VERSION=${{ inputs.trivy_version }}" >> $GITHUB_ENV
21+
1822 - name : Update Trivy versions
19- run : |
20- find test/data -type f -name '*.test' | xargs sed -r -i 's/"version": "[0-9]+\.[0-9]+\.[0-9]+"/"version": "${{ inputs.trivy_version }}"/'
21- sed -r -i '/^\| `version`/ s/[0-9]+\.[0-9]+\.[0-9]+/${{ inputs.trivy_version }}/g' README.md
22- sed -r -i 's/(default:[ ]*'"'"')v[0-9]+\.[0-9]+\.[0-9]+/\1v${{ inputs.trivy_version }}/' action.yaml
23+ run : make bump-trivy
2324
2425 - name : Create PR
2526 id : create-pr
Original file line number Diff line number Diff line change 11OS := $(shell uname)
2+ SED = sed
3+ BATS_LIB_PATH = /usr/local/lib/
4+
25ifeq ($(OS ) , Darwin)
3- BATS_LIB_PATH =/opt/homebrew/lib
4- endif
5- ifeq ($(OS ) , Linux)
6- BATS_LIB_PATH =/usr/local/lib/
6+ SED = gsed
7+ BATS_LIB_PATH = /opt/homebrew/lib
78endif
89
9-
1010.PHONY : test
1111test :
1212 mkdir -p .cache
1313 BATS_LIB_PATH=$(BATS_LIB_PATH ) GITHUB_REPOSITORY_OWNER=aquasecurity\
1414 TRIVY_CACHE_DIR=.cache TRIVY_DISABLE_VEX_NOTICE=true TRIVY_DEBUG=true\
1515 bats --recursive --timing --verbose-run .
16+
17+ bump-trivy :
18+ @[ $$ NEW_VERSION ] || ( echo " env 'NEW_VERSION' is not set" ; exit 1 )
19+ @CURRENT_VERSION=$$(grep "TRIVY_VERSION:" .github/workflows/test.yaml | awk '{print $$2}' ) ; \
20+ echo Current version: $$ CURRENT_VERSION ; \
21+ echo New version: $$ NEW_VERSION ; \
22+ $(SED ) -i -e " s/$$ CURRENT_VERSION/$$ NEW_VERSION/g" README.md action.yaml .github/workflows/test.yaml ; \
You can’t perform that action at this time.
0 commit comments