Skip to content

Commit

Permalink
Merge pull request #44 from lacework/edoardo/cache-installation
Browse files Browse the repository at this point in the history
Cache installation of components to reduce API calls
  • Loading branch information
edoardopirovano authored Mar 15, 2023
2 parents 43b51ed + cd07df9 commit 2246cc9
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,21 @@ outputs:
runs:
using: 'composite'
steps:
- shell: bash
- id: init
shell: bash
run: |
SCA_VERSION=0.0.22
SAST_VERSION=0.0.33
curl https://raw.githubusercontent.com/lacework/go-sdk/main/cli/install.sh | bash
echo "cache-key=$(date +'%Y-%m-%d')-$SCA_VERSION-$SAST_VERSION" >> $GITHUB_OUTPUT
- id: cache
uses: actions/cache/restore@v3
with:
path: ~/.config/lacework/components
key: lacework-${{ steps.init.outputs.cache-key }}
- if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
echo "::group::Installing Lacework CLI components"
lacework --noninteractive -a "${LW_ACCOUNT_NAME}" -k "${LW_API_KEY}" -s "${LW_API_SECRET}" component install sca --version "${SCA_VERSION}"
lacework --noninteractive -a "${LW_ACCOUNT_NAME}" -k "${LW_API_KEY}" -s "${LW_API_SECRET}" component install sast --version "${SAST_VERSION}"
Expand All @@ -63,6 +73,13 @@ runs:
lacework --noninteractive -a "${LW_ACCOUNT_NAME}" -k "${LW_API_KEY}" -s "${LW_API_SECRET}" version
lacework --noninteractive -a "${LW_ACCOUNT_NAME}" -k "${LW_API_KEY}" -s "${LW_API_SECRET}" component list
echo "::endgroup::"
- if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: ~/.config/lacework/components
key: lacework-${{ steps.init.outputs.cache-key }}
- shell: bash
run: |
cp -r "${{ github.action_path }}" ../lacework-code-security
cd ../lacework-code-security
HUSKY=0 npm install
Expand Down

0 comments on commit 2246cc9

Please sign in to comment.