From e3749e0f76d3e6b0c3d23de6e6e64b5530ea8e31 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Thu, 17 Nov 2022 21:14:54 +0100 Subject: [PATCH] Cleanup pip cache workaround [ci] (#82272) --- .github/workflows/cache.yml | 56 ------------------------------------- .github/workflows/ci.yaml | 4 +++ 2 files changed, 4 insertions(+), 56 deletions(-) delete mode 100644 .github/workflows/cache.yml diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml deleted file mode 100644 index ca80d54ad6a..00000000000 --- a/.github/workflows/cache.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Delete Caches - -# yamllint disable-line rule:truthy -on: - pull_request: - types: [closed] - workflow_dispatch: - inputs: - pr-number: - description: "Closed PR number" - type: string - required: true - -jobs: - delete: - name: "Delete unused caches (PR #${{ github.event.inputs.pr-number || github.event.number }})" - runs-on: ubuntu-latest - permissions: - actions: write - steps: - - name: Delete caches - run: | - ref="refs/pull/${{ github.event.inputs.pr-number || github.event.number }}/merge" - - page=1 - per_page=100 - del_count=0 - - while true; do - res=$(curl -fsS \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: token ${{ github.token }}" \ - "https://api.github.com/repos/${{ github.repository }}/actions/caches?per_page=$per_page&page=$page") - - res_count=$(echo $res | jq '.actions_caches | length') - if [ $res_count -eq 0 ]; then break; fi - - targets=$(echo $res | jq \ - --arg ref "$ref" \ - '.actions_caches[] | select(.ref == $ref) | del(.created_at, .size_in_bytes, .version)') - echo "$targets" - - for id in $(echo $targets | jq '.id'); do - curl -sS \ - -X DELETE \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: token ${{ github.token }}" \ - "https://api.github.com/repos/${{ github.repository }}/actions/caches/$id" - ((del_count+=1)) - done - - if [ $res_count -lt $per_page ]; then break; fi - ((page+=1)) - done - - echo "Delete $del_count caches." diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cd21717142a..eadcc082732 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -558,6 +558,10 @@ jobs: - base permissions: actions: write + # Limit to 'dev' branch until permissions issue is resolved + # https://github.com/home-assistant/core/pull/80898 + # https://github.com/home-assistant/core/pull/82254 + if: github.ref == 'refs/heads/dev' steps: - name: Cleanup run: |