ci: merge removal of workflows with stale.yml and remove untagged docker images on release only

This commit is contained in:
lowlighter
2021-11-15 20:42:34 -05:00
parent f3f070b82d
commit 4d464ddf09
3 changed files with 34 additions and 48 deletions

20
.github/workflows/clean.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
name: Clean untagged docker images from ghcr.io
on:
release:
- published
workflow_dispatch:
jobs:
clean:
name: Clean untagged docker images from ghcr.io
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run script
run: ./delete_ghcr_dangling_images.sh lowlighter metrics
working-directory: .github/workflows/maintenance
env:
GITHUB_TOKEN: ${{ secrets.GHCR_BOT_TOKEN }}

View File

@@ -1,46 +0,0 @@
name: Maintenance 🧰
on:
schedule:
- cron: "30 2 * * *"
workflow_dispatch:
jobs:
workflow_removal:
runs-on: ubuntu-latest
name: Workflow cleanup 🧹👷‍♂️
# Errors will probably be caused by excesses in API quota, so we can safely continue.
# Remaining workflows will be removed in the next scheduled run.
continue-on-error: true
steps:
- name: Clone repository
uses: actions/checkout@v2.3.4
- name: Run deletion script 🗑
run: ./delete_workflows.sh lowlighter/metrics
working-directory: ./.github/workflows/maintenance
env:
GITHUB_TOKEN: ${{ github.token }}
dangling_images_removal:
runs-on: ubuntu-latest
name: Cleanup dangling images from GHCR 🧹📦
# Errors will probably be caused by excesses in API quota, so we can safely continue.
# Remaining workflows will be removed in the next scheduled run.
continue-on-error: true
# Pay attention that the org name is not necessary here, as gh will automatically take the one from the logged in user.
strategy:
fail-fast: false
matrix:
container:
- 'metrics'
steps:
- name: Clone repository
uses: actions/checkout@v2.3.4
- name: Run deletion script 🗑
run: ./delete_ghcr_dangling_images.sh lowlighter ${{ matrix.container }}
working-directory: ./.github/workflows/maintenance
env:
GITHUB_TOKEN: ${{ secrets.GHCR_BOT_TOKEN }}

View File

@@ -1,4 +1,4 @@
name: Stale issue and pull requests
name: Stale issues, pull requests and workflow runs
on:
schedule:
@@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token: ${{ github.token }}
stale-pr-message: This pull request seems to be inactive and will be automatically closed in a few days if it remains without any activity.
days-before-pr-stale: 21
days-before-pr-close: 3
@@ -34,3 +34,15 @@ jobs:
pr-lock-inactive-days: 14
pr-lock-reason: ""
pr-lock-labels: ☑️ archived
workflows:
name: Remove expired workflow runs
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run script
run: ./delete_workflows.sh lowlighter/metrics
working-directory: .github/workflows/maintenance
env:
GITHUB_TOKEN: ${{ github.token }}