Skip to content

Commit

Permalink
Merge pull request #305 from CSHS-CWRA/remove-obsolete-caches
Browse files Browse the repository at this point in the history
Remove obsolete caches GitHub Workflow
  • Loading branch information
Zeitsperre authored Sep 18, 2023
2 parents a5fe182 + ffc571d commit 43bb769
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/remove-obsolete-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Example taken from https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#managing-caches
name: Cleanup Caches on PR Merge

on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
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 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ History
-------------------
* `RavenPy` now uses `platformdirs` to write `raven_testing` to the user's cache directory. Dynamic paths are now used to cache data dependent on the user's operating system. Developers can now safely delete the `.raven_testing_data` folder in their home directory without affecting the functionality of `RavenPy`.
* Updated `raven-hydro` to v0.2.4 to address CMake build issues.
* Added a workflow to remove obsolete GitHub Workflow cache files.

0.12.2 (2023-07-04)
-------------------
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ channels:
dependencies:
- python >=3.8,<3.12
- raven-hydro ==0.2.4
- libgcc # for mixing raven-hydro from PyPI with conda environments
- affine
- cftime
- cf_xarray
Expand Down

0 comments on commit 43bb769

Please sign in to comment.