Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a GH workflow to cleanup the GH cache #6080

Merged
merged 1 commit into from
Aug 31, 2023
Merged

Conversation

stnguyen90
Copy link
Contributor

@stnguyen90 stnguyen90 commented Aug 30, 2023

What does this PR do?

The GitHub actions cache is helpful to speed up CI jobs. Once a branch is closed, we don't need the cacche anymore so we should delete it so the disk space can be reclaimed.

This workflow was copied from https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries.

Test Plan

https://github.com/appwrite/appwrite/actions/runs/6031274668/job/16364664657?pr=6080

Related PRs and Issues

None

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

@stnguyen90 stnguyen90 marked this pull request as ready for review August 30, 2023 22:41
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"

echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we remove -L 100 it will clear the entire cache instead of only the oldest 100

Copy link
Contributor Author

@stnguyen90 stnguyen90 Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default limit is 30. Max limit is 100: https://github.com/actions/gh-actions-cache#list

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we paginate and delete them all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

The GitHub actions cache is helpful to speed up CI jobs. Once a branch
is closed, we don't need the cacche anymore so we should delete it so
the disk space can be reclaimed.

This workflow was copied from https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries.
@christyjacob4 christyjacob4 merged commit 69e5e7f into master Aug 31, 2023
6 checks passed
@stnguyen90 stnguyen90 deleted the feat-github-cache branch September 10, 2023 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants