diff --git a/action.yaml b/action.yaml index fd1f64e7..870b03bc 100644 --- a/action.yaml +++ b/action.yaml @@ -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}" @@ -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