Skip to content

Update Rust crate tarpc to v0.34.0 #2947

Update Rust crate tarpc to v0.34.0

Update Rust crate tarpc to v0.34.0 #2947

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 }}