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:
		
							
								
								
									
										11
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							| @@ -136,6 +136,7 @@ jobs: | |||||||
|     permissions: |     permissions: | ||||||
|       contents: read |       contents: read | ||||||
|       packages: read |       packages: read | ||||||
|  |       actions: write | ||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
|       - name: Checkout master directory |       - name: Checkout master directory | ||||||
| @@ -475,6 +476,16 @@ jobs: | |||||||
|           name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs |           name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs | ||||||
|           path: "openwrt/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 |       - name: Save ccache cache | ||||||
|         uses: actions/cache/save@v3 |         uses: actions/cache/save@v3 | ||||||
|         with: |         with: | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								.github/workflows/coverity.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/coverity.yml
									
									
									
									
										vendored
									
									
								
							| @@ -15,6 +15,7 @@ jobs: | |||||||
|     permissions: |     permissions: | ||||||
|       contents: read |       contents: read | ||||||
|       packages: read |       packages: read | ||||||
|  |       actions: write | ||||||
|     uses: ./.github/workflows/build.yml |     uses: ./.github/workflows/build.yml | ||||||
|     with: |     with: | ||||||
|       container_name: toolchain |       container_name: toolchain | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								.github/workflows/kernel.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/kernel.yml
									
									
									
									
										vendored
									
									
								
							| @@ -105,6 +105,7 @@ jobs: | |||||||
|     permissions: |     permissions: | ||||||
|       contents: read |       contents: read | ||||||
|       packages: read |       packages: read | ||||||
|  |       actions: write | ||||||
|     strategy: |     strategy: | ||||||
|        fail-fast: False |        fail-fast: False | ||||||
|        matrix: |        matrix: | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								.github/workflows/label-kernel.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/label-kernel.yml
									
									
									
									
										vendored
									
									
								
							| @@ -30,6 +30,7 @@ jobs: | |||||||
|     permissions: |     permissions: | ||||||
|       contents: read |       contents: read | ||||||
|       packages: read |       packages: read | ||||||
|  |       actions: write | ||||||
|     uses: ./.github/workflows/build.yml |     uses: ./.github/workflows/build.yml | ||||||
|     with: |     with: | ||||||
|       container_name: toolchain |       container_name: toolchain | ||||||
| @@ -44,6 +45,7 @@ jobs: | |||||||
|     permissions: |     permissions: | ||||||
|       contents: read |       contents: read | ||||||
|       packages: read |       packages: read | ||||||
|  |       actions: write | ||||||
|     uses: ./.github/workflows/check-kernel-patches.yml |     uses: ./.github/workflows/check-kernel-patches.yml | ||||||
|     with: |     with: | ||||||
|       target: ${{ needs.set_target.outputs.target }} |       target: ${{ needs.set_target.outputs.target }} | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								.github/workflows/label-target.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/label-target.yml
									
									
									
									
										vendored
									
									
								
							| @@ -30,6 +30,7 @@ jobs: | |||||||
|     permissions: |     permissions: | ||||||
|       contents: read |       contents: read | ||||||
|       packages: read |       packages: read | ||||||
|  |       actions: write | ||||||
|     uses: ./.github/workflows/build.yml |     uses: ./.github/workflows/build.yml | ||||||
|     with: |     with: | ||||||
|       container_name: toolchain |       container_name: toolchain | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								.github/workflows/packages.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/packages.yml
									
									
									
									
										vendored
									
									
								
							| @@ -35,6 +35,7 @@ jobs: | |||||||
|     permissions: |     permissions: | ||||||
|       contents: read |       contents: read | ||||||
|       packages: read |       packages: read | ||||||
|  |       actions: write | ||||||
|     strategy: |     strategy: | ||||||
|       fail-fast: False |       fail-fast: False | ||||||
|       matrix: |       matrix: | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								.github/workflows/push-containers.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/push-containers.yml
									
									
									
									
										vendored
									
									
								
							| @@ -153,6 +153,7 @@ jobs: | |||||||
|     permissions: |     permissions: | ||||||
|       contents: read |       contents: read | ||||||
|       packages: read |       packages: read | ||||||
|  |       actions: write | ||||||
|     strategy: |     strategy: | ||||||
|       fail-fast: False |       fail-fast: False | ||||||
|       matrix: |       matrix: | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								.github/workflows/toolchain.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/toolchain.yml
									
									
									
									
										vendored
									
									
								
							| @@ -61,6 +61,7 @@ jobs: | |||||||
|     permissions: |     permissions: | ||||||
|       contents: read |       contents: read | ||||||
|       packages: read |       packages: read | ||||||
|  |       actions: write | ||||||
|     strategy: |     strategy: | ||||||
|        fail-fast: False |        fail-fast: False | ||||||
|        matrix: |        matrix: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Christian Marangi
					Christian Marangi