-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: using cache and move remove cache on another workflow
- Loading branch information
Showing
3 changed files
with
38 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Delete old caches | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
delete: | ||
branches-ignore: | ||
- master | ||
|
||
permissions: | ||
actions: write | ||
|
||
jobs: | ||
delete_cache: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clear cache | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
console.log("About to clear") | ||
const caches = await github.rest.actions.getActionsCacheList({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}) | ||
for (const cache of caches.data.actions_caches) { | ||
console.log(cache) | ||
if (cache.ref != 'refs/heads/master') { | ||
github.rest.actions.deleteActionsCacheById({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
cache_id: cache.id, | ||
}) | ||
} | ||
} | ||
console.log("Clear completed") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,30 +136,4 @@ jobs: | |
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
git tag ${{ env.V-VERSION }} | ||
git push origin ${{ env.V-VERSION }} | ||
clear-cache: | ||
permissions: | ||
actions: write | ||
|
||
runs-on: ubuntu-latest | ||
needs: [ push-tag ] | ||
steps: | ||
- name: Clear cache | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
console.log("About to clear") | ||
const caches = await github.rest.actions.getActionsCacheList({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}) | ||
for (const cache of caches.data.actions_caches) { | ||
console.log(cache) | ||
github.rest.actions.deleteActionsCacheById({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
cache_id: cache.id, | ||
}) | ||
} | ||
console.log("Clear completed") | ||
git push origin ${{ env.V-VERSION }} |