From f2d29ced0a1977ae5864fbf9bffc54bf00921274 Mon Sep 17 00:00:00 2001 From: "Denis S. Soldatov aka General-Beck" Date: Thu, 16 Jul 2020 17:13:32 +0300 Subject: [PATCH] [WIP] Fix cleanup cache (#190) * Fix cleanup cache * echo github.env * Cleanup always --- .github/workflows/rust.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e54279a94f63..668fd9cf66f5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -50,6 +50,7 @@ jobs: echo "::set-env name=CARGO_TARGET_DIR::/cache/${{ github.head_ref }}/${{ matrix.toolchain }}" - name: Cache checking if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'reopened' + continue-on-error: true run: | echo "Copy cache from master"; mkdir -p $CARGO_TARGET_DIR; @@ -120,6 +121,17 @@ jobs: path: artifacts/ ## Cleanup stage - name: Cleanup after merge pull request - if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true - run: rm -rf $CARGO_TARGET_DIR + if: always() + run: | + #debug + if ${{ github.event_name == 'pull_request' }} && ${{ github.event.action == 'closed' }} && ${{ github.event.pull_request.merged == true }}; then + echo "merged, cleaning"; + rm -rf $CARGO_TARGET_DIR; + else + echo "nothing to do" + fi; + echo "github.event_name == " ${{ github.event_name }}; + echo "github.event.action == " ${{ github.event.action }}; + echo "github.event.pull_request.merged == " ${{ github.event.pull_request.merged }}; + echo "github.ref == " ${{ github.ref }}; shell: bash