Skip to content

Update Rust crate tokio-stream to v0.1.16 #2546

Update Rust crate tokio-stream to v0.1.16

Update Rust crate tokio-stream to v0.1.16 #2546

name: Cleanup obsolete caches
on:
pull_request:
types:
- closed
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Remove caches
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 | 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 }}
- name: Remove untagged docker images
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr_tag = "pr-${{ github.event.pull_request.number }}"
for (const image of ["hash-graph-cache", "hash-ai-worker-ts-cache", "hash-integration-worker-cache"]) {
const url = "/orgs/hashintel/packages/container/" + image + "/versions";
const response = await github.request("GET " + url, { per_page: 100 });
for (const version of response.data) {
if (version.metadata.container.tags.length == 0 || version.metadata.container.tags.includes(pr_tag)) {
console.log("delete " + version.id)
const deleteResponse = await github.request("DELETE " + url + "/" + version.id, { });
console.log("status " + deleteResponse.status)
}
}
}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}