Skip to content

build(deps): bump peter-evans/create-pull-request from 7.0.8 to 8.1.1 #9

build(deps): bump peter-evans/create-pull-request from 7.0.8 to 8.1.1

build(deps): bump peter-evans/create-pull-request from 7.0.8 to 8.1.1 #9

name: Call Clean GHCR image

Check failure on line 1 in .github/workflows/call-clean-ghcr.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/call-clean-ghcr.yaml

Invalid workflow file

(Line: 15, Col: 13): Unexpected value ''
on:
workflow_call:
inputs:
image_name:
required: true
type: string
older_than:
required: false
type: string
tag_regex:
required: false
type: string
secrets:
workflow_dispatch:
inputs:
image_name:
description: "image name"
required: true
default: "spiderpool-controller-ci"
older_than:
description: "Minimum days of a version before pruned"
required: true
default: "0"
keep_last:
description: "exclude count of most recent images"
required: true
default: "1"
dry_run:
description: "dry run (true|false)"
required: true
default: "true"
jobs:
purge-image:
name: Delete image from ghcr.io
runs-on: ubuntu-latest
steps:
- name: Get Arg
id: args
run: |
# spiderpool-bot/github_action_test
repo=${{ github.repository }}
# github_action_test
repo=${repo#*/}
echo "repo_name=${repo}" >> $GITHUB_ENV
if ${{ inputs.image_name != '' }} ; then
echo "call by workflow_call"
echo "image_name=${{ inputs.image_name }}" >> $GITHUB_ENV
echo "tag_regex=${{ github.event.inputs.tag_regex }}" >> $GITHUB_ENV
echo "older_than=${{ inputs.older_than }}" >> $GITHUB_ENV
echo "dry_run=false" >> $GITHUB_ENV
echo "keep_last=0" >> $GITHUB_ENV
elif ${{ github.event_name == 'workflow_dispatch' }} ; then
echo "call by workflow_dispatch"
echo "image_name=${{ github.event.inputs.image_name }}" >> $GITHUB_ENV
echo "tag_regex=" >> $GITHUB_ENV
echo "older_than=${{ github.event.inputs.older_than }}" >> $GITHUB_ENV
echo "dry_run=${{ github.event.inputs.dry_run }}" >> $GITHUB_ENV
echo "keep_last=${{ github.event.inputs.keep_last }}" >> $GITHUB_ENV
else
echo "unexpected event: ${{ github.event_name }}"
exit 1
fi
- name: Delete CI image
if: ${{ env.tag_regex != '' }}
uses: vlaurin/action-ghcr-prune@v0.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
organization: ${{ github.repository_owner }}
container: ${{ env.repo_name }}/${{ env.image_name }}
dry-run: ${{ env.dry_run }}
older-than: ${{ env.older_than }}
keep-last: ${{ env.keep_last }}
untagged: true
tag-regex: ${{ env.tag_regex }}
- name: Delete CI image
if: ${{ env.tag_regex == '' }}
uses: vlaurin/action-ghcr-prune@v0.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
organization: ${{ github.repository_owner }}
container: ${{ env.repo_name }}/${{ env.image_name }}
dry-run: ${{ env.dry_run }}
older-than: ${{ env.older_than }}
keep-last: ${{ env.keep_last }}
untagged: true