CI: build: add job to remove previous ccache cache if already exist

Github Actions cache doesn't permit to overwrite cache if it does
already exist. As a trick to refresh and have fresh ccache pool,
delete the ccache cache if it does exist with the help of Github REST
API. An additional permission is needed to access this API. Add this
permittion to each user of the build workflow.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Christian Marangi 2023-05-28 02:55:26 +02:00
parent 6321361c6b
commit 203cc0a7ef
No known key found for this signature in database
GPG Key ID: AC001D09ADBFEAD7
8 changed files with 19 additions and 0 deletions

View File

@ -136,6 +136,7 @@ jobs:
permissions:
contents: read
packages: read
actions: write
steps:
- name: Checkout master directory
@ -475,6 +476,16 @@ jobs:
name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs
path: "openwrt/logs"
- name: Delete already present ccache cache
if: steps.restore-ccache-cache.outputs.cache-hit == 'true'
uses: octokit/request-action@v2.x
with:
route: DELETE /repos/{repository}/actions/caches?key={key}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_REPOSITORY: ${{ github.repository }}
INPUT_KEY: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }}
- name: Save ccache cache
uses: actions/cache/save@v3
with:

View File

@ -15,6 +15,7 @@ jobs:
permissions:
contents: read
packages: read
actions: write
uses: ./.github/workflows/build.yml
with:
container_name: toolchain

View File

@ -105,6 +105,7 @@ jobs:
permissions:
contents: read
packages: read
actions: write
strategy:
fail-fast: False
matrix:

View File

@ -30,6 +30,7 @@ jobs:
permissions:
contents: read
packages: read
actions: write
uses: ./.github/workflows/build.yml
with:
container_name: toolchain
@ -44,6 +45,7 @@ jobs:
permissions:
contents: read
packages: read
actions: write
uses: ./.github/workflows/check-kernel-patches.yml
with:
target: ${{ needs.set_target.outputs.target }}

View File

@ -30,6 +30,7 @@ jobs:
permissions:
contents: read
packages: read
actions: write
uses: ./.github/workflows/build.yml
with:
container_name: toolchain

View File

@ -35,6 +35,7 @@ jobs:
permissions:
contents: read
packages: read
actions: write
strategy:
fail-fast: False
matrix:

View File

@ -153,6 +153,7 @@ jobs:
permissions:
contents: read
packages: read
actions: write
strategy:
fail-fast: False
matrix:

View File

@ -61,6 +61,7 @@ jobs:
permissions:
contents: read
packages: read
actions: write
strategy:
fail-fast: False
matrix: