Skip to content

Commit

Permalink
fix: add contrib dir (#13)
Browse files Browse the repository at this point in the history
* feat: copy `contrib` dir into `<path>/trivy-bin`

* fix: use `-r` for remove `trivy` repo

* refactor: remove extra line
  • Loading branch information
DmitriyLewen authored Oct 23, 2024
1 parent a8e37c4 commit 5ef739f
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,23 @@ runs:
with:
repository: aquasecurity/trivy
sparse-checkout: |
contrib/install.sh
sparse-checkout-cone-mode: false
contrib
path: trivy
fetch-depth: 1

## Install Trivy using install script,
## Copy the `contrib` directory to the directory with the binary
## Remove the `trivy` directory produced by the checkout step, as it may cause errors in linters/checks in the calling code.
- name: Install Trivy
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
echo "installing Trivy binary"
bash ./trivy/contrib/install.sh -b ${{ steps.binary-dir.outputs.dir }} ${{ inputs.version }}
cp -r ./trivy/contrib ${{ steps.binary-dir.outputs.dir }}/contrib
rm -rf ./trivy
## Add the Trivy binary, retrieved from cache or installed by a script, to $GITHUB_PATH
- name: Add Trivy binary to $GITHUB_PATH
shell: bash
run: echo ${{ steps.binary-dir.outputs.dir }} >> $GITHUB_PATH

## Remove the Trivy Installation Script as this might cause other linters/checks in the calling
## workflow to fail on the unexpected file
- name: Remove Trivy Installation Script
shell: bash
if: steps.cache.outputs.cache-hit != 'true'
run: |
rm -f ./trivy/contrib/install.sh

0 comments on commit 5ef739f

Please sign in to comment.