-
Notifications
You must be signed in to change notification settings - Fork 5
53 lines (48 loc) · 1.37 KB
/
cleanup_docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Cleanup docker
# Triggered when a pull request is merged
on:
workflow_dispatch:
inputs:
dockerImage:
description: 'Docker image to delete'
required: false
type: string
workflow_call:
inputs:
dockerImage:
description: 'Docker image to delete'
required: false
type: string
jobs:
cleanup:
name: Cleanup
permissions:
id-token: write
contents: read
runs-on: ubuntu-20.04
strategy:
fail-fast: true
max-parallel: 1
matrix:
environment: [Dev]
region: [us-east-1]
# environment:
# name: ${{ matrix.environment }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Add inputs to GITHUB_ENV
run: |
echo "DOCKER_IMAGE=${{ inputs.dockerImage }}" >> $GITHUB_ENV
- name: Delete image
if: "${{ always() && env.DOCKER_IMAGE != ''}}"
uses: bots-house/[email protected]
with:
# NOTE: at now only orgs is supported
owner: ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}
name: ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}
# NOTE: using Personal Access Token
token: ${{ secrets.PAT }}
tag: ${{ env.DOCKER_IMAGE }}