From 790aea092bf7f46ae5fe73a7580730b2a0af2297 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 12 Jan 2024 12:48:04 +0100 Subject: [PATCH] Add possibility to disable cache --- .github/workflows/main.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d6438c9ed37c..ac3761f6d40c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -104,9 +104,21 @@ jobs: - '**.ac' - '**.in' list-files: shell + - name: "Check '@github-action disable-cache' in PR Comment" + id: issue_comment + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + shell: /usr/bin/bash {0} + run: | + ISSUE_COMMENTS=$(gh api -H "Accept: application/vnd.github+json" /repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments | jq ".[] | .body") + if echo "${ISSUE_COMMENT_BODIES}" | grep "@github-actions disable-cache"; then + echo "DISABLE_CACHE=true" >> $GITHUB_OUTPUT + else + echo "DISABLE_CACHE=false" >> $GITHUB_OUTPUT + fi - name: Restore from cache env: - NO_CACHE: ${{ steps.cache.outputs.no-cache || steps.cache.outputs.deleted_count > 20 }} + NO_CACHE: ${{ (steps.cache.outputs.no-cache || (steps.cache.outputs.deleted_count > 20)) || (steps.issue_comment.outputs.DISABLE_CACHE == "true") }} BOOTSTRAP: ${{ steps.cache.outputs.bootstrap }} CONFIGURE: ${{ steps.cache.outputs.configure }} EVENT: ${{ github.event_name }}