Skip to content

refactor: 🗃️ drop null values on project description #709

refactor: 🗃️ drop null values on project description

refactor: 🗃️ drop null values on project description #709

Workflow file for this run

name: Clean cache
on:
pull_request:
types:
- closed
workflow_dispatch:
inputs:
PR_NUMBER:
description: ID number of the pull request assiocited with the cache
required: false
type: number
BRANCH_NAME:
description: Branch name assiocited with the cache
required: false
type: string
jobs:
cleanup-cache:
name: Delete gituhb cache
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Clean cache for closed branch
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
if [ -n "${{ inputs.BRANCH_NAME }}" ]; then
BRANCH="${{ inputs.BRANCH_NAME }}"
else
BRANCH="refs/pull/${{ github.event.pull_request.number || inputs.PR_NUMBER }}/merge"
fi
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 }}
matrix:
name: Generate matrix
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.number || github.event.number }}
outputs:
build-matrix: ${{ steps.build-matrix.outputs.BUILD_MATRIX }}
steps:
- name: Checks-out repository
uses: actions/checkout@v4
- name: Generate matrix
id: build-matrix
run: |
echo "BUILD_MATRIX=$(jq -c . < ./ci/matrix-docker.json)" >> $GITHUB_OUTPUT
cleanup-image:
name: Delete image from ghcr.io
runs-on: ubuntu-latest
needs:
- matrix
strategy:
matrix:
images: ${{ fromJSON(needs.matrix.outputs.build-matrix) }}
steps:
- name: Checks-out repository
uses: actions/checkout@v4
- name: Get repository owner and name
id: image-infos
run: |
echo "ORG_NAME=$(echo '${{ github.repository }}' | cut -d "/" -f 1)" >> $GITHUB_OUTPUT
echo "REPO_NAME=$(echo '${{ github.repository }}' | cut -d "/" -f 2)" >> $GITHUB_OUTPUT
- name: Delete ${{ matrix.images.name }} image
run: |
./ci/scripts/delete-image.sh \
-o "${{ steps.image-infos.outputs.ORG_NAME }}" \
-i "${{ steps.image-infos.outputs.REPO_NAME }}/${{ matrix.images.name }}" \
-t "pr-${{ github.event.pull_request.number || github.event.number }}" \
-g "${{ secrets.GITHUB_TOKEN }}"