File tree Expand file tree Collapse file tree 2 files changed +52
-29
lines changed Expand file tree Collapse file tree 2 files changed +52
-29
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ name : Delete quay image of PR once merged
2
+ on :
3
+ push :
4
+ branches :
5
+ - ' main'
6
+
7
+ permissions :
8
+ pull-requests : read
9
+ env :
10
+ QUAY_IMAGE_REPO : ${{ secrets.QUAY_IMAGE_REPO }}
11
+ jobs :
12
+ delete-pr-quay-image :
13
+ runs-on : ubuntu-latest
14
+ steps :
15
+ - name : Git checkout
16
+ uses : actions/checkout@v3
17
+ with :
18
+ fetch-depth : ' 0'
19
+ - name : Install skopeo
20
+ shell : bash
21
+ run : |
22
+ sudo apt-get -y update
23
+ sudo apt-get -y install skopeo
24
+ - name : Get Pull Request Number
25
+ uses : actions/github-script@v6
26
+ id : get_issue_number
27
+ with :
28
+ script : |
29
+ if (context.issue.number) {
30
+ // Return issue number if present
31
+ return context.issue.number;
32
+ } else {
33
+ // Otherwise return issue number from commit
34
+ return (
35
+ await github.rest.repos.listPullRequestsAssociatedWithCommit({
36
+ commit_sha: context.sha,
37
+ owner: context.repo.owner,
38
+ repo: context.repo.repo,
39
+ })
40
+ ).data[0].number;
41
+ }
42
+ result-encoding : string
43
+ env :
44
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
45
+ - name : Delete PR image
46
+ shell : bash
47
+ env :
48
+ PR : ${{steps.get_issue_number.outputs.result}}
49
+ QUAY_ROBOT_USERNAME : ${{ secrets.QUAY_ROBOT_USERNAME }}
50
+ QUAY_ROBOT_TOKEN : ${{ secrets.QUAY_ROBOT_TOKEN }}
51
+ run : |
52
+ skopeo delete --creds ${QUAY_ROBOT_USERNAME}:${QUAY_ROBOT_TOKEN} docker://${QUAY_IMAGE_REPO}:pr-${{ env.PR }}
You can’t perform that action at this time.
0 commit comments