summaryrefslogtreecommitdiff
path: root/.github/workflows/cleanup.yml
blob: 5041c69e2ff2282a14a81940ad536d8d6e84bb23 (plain)
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
---
name: Cleanup

# yamllint disable-line rule:truthy
on:
  workflow_dispatch:
  schedule:
    - cron: "4 4 * * *"

concurrency:
  group: ${{ github.workflow }}
  cancel-in-progress: false

permissions:
  contents: read

jobs:
  registry:
    # FIXME: On forks it fails with "Failed to fetch packages: missing field `id` at line 1 column 141"
    if: github.repository_owner == 'searxng' || github.event_name == 'workflow_dispatch'
    name: Registry
    runs-on: ubuntu-24.04
    permissions:
      # Organization GHCR
      packages: write

    steps:
      - name: Prune
        uses: snok/container-retention-policy@4f22ef80902ad409ed55a99dc5133cc1250a0d03  # v3.0.0
        with:
          account: "${{ github.repository_owner }}"
          token: "${{ secrets.GITHUB_TOKEN }}"
          # Remove only cache images https://github.com/snok/container-retention-policy/issues/97
          image-names: "cache"
          image-tags: "!searxng*"
          cut-off: "1d"
          keep-n-most-recent: "30"