-
Notifications
You must be signed in to change notification settings - Fork 195
41 lines (38 loc) · 1.3 KB
/
docker.yml
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
name: Update Tutorial Images
on:
schedule:
# 5 PM UTC every Sunday
- cron: '0 17 * * 6'
workflow_dispatch:
push:
branches:
- main
jobs:
call-docker-images:
uses: ./.github/workflows/docker-images.yml
secrets: inherit
delete-untagged:
runs-on: ubuntu-latest
needs:
- call-docker-images
steps:
- name: Delete Untagged Images
if: (github.event_name == 'schedule')
uses: actions/github-script@v6
with:
github-token: ${{ secrets.DELETE_PACKAGES_TOKEN }}
script: |
const response = await github.request("GET /orgs/${{ env.OWNER }}/packages/container/${{ env.PACKAGE_NAME }}/versions", {
per_page: ${{ env.PER_PAGE }}
});
for(version of response.data) {
if (version.metadata.container.tags.length == 0) {
console.log("delete " + version.id)
const deleteResponse = await github.request("DELETE /orgs/${{ env.OWNER }}/packages/container/${{ env.PACKAGE_NAME }}/versions/" + version.id, { });
console.log("status " + deleteResponse.status)
}
}
env:
OWNER: ${{ github.repository_owner }}
PACKAGE_NAME: moveit2_tutorials
PER_PAGE: 100