Giter Club home page Giter Club logo

delete-old-packages's People

Contributors

kcerb avatar nickdandakis avatar prom3theu5 avatar rubengees avatar tisoft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

delete-old-packages's Issues

Rename branch master to main.

I would like it if branch master could be renamed to match github repositories made after git decided to default the default branch names to main.

Deleting more than 20 packages at a time.

may be a param can be added that will allow to delete more than 20 packages.

    at new Strategy (/home/runner/work/_actions/smartsquaregmbh/delete-old-packages/v0.3.1/dist/index.js:13:60269)
    at new RepoStrategy (/home/runner/work/_actions/smartsquaregmbh/delete-old-packages/v0.3.1/dist/index.js:13:58597)
    at getStrategyFromInput (/home/runner/work/_actions/smartsquaregmbh/delete-old-packages/v0.3.1/dist/index.js:13:64024)
    at /home/runner/work/_actions/smartsquaregmbh/delete-old-packages/v0.3.1/dist/index.js:13:64106
    at /home/runner/work/_actions/smartsquaregmbh/delete-old-packages/v0.3.1/dist/index.js:13:64165
    at Object.<anonymous> (/home/runner/work/_actions/smartsquaregmbh/delete-old-packages/v0.3.1/dist/index.js:13:64204)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)```

use semver with --include-prerelease

it would be great to have an option to use semver with --include-prerelease; else old prerelease packages can't be deleted.
For example
"<1.23.0"
does not find the version
"1.22.1-alpha"
at the moment

Question: Correct way to escape regex?

I found this project via the marketplace.
It seems just what we are looking for; thanks a lot for your efforts.

Question
I have been trying to set up a regex which matches the following format:
1.8.9--canary.203.7f11a0e.0
1.0.3-canary.23.af8d421.0

Pre-escaping: "^\d+\.\d+\.\d+--canary\.+.*"

I have tried many different combinations with no joy. This is what I currently have:

jobs:
  block-fixup:
    runs-on: ubuntu-18.04
    steps:
      - uses: smartsquaregmbh/[email protected]
        with:
         version-pattern: "^\\d+\\.\\d+\\.\\d+--canary\\.+.*"
         dry-run: true
         names: |
            package

Any pointers would be greatly appreciated!

no package deleted in current repo

Hi,

i am using this action with package name build from a previous step that parse my pom.xml to retrieve package name.

      - name: Clean old packages - keep last 3
        uses: smartsquaregmbh/[email protected]
        with:
          keep: 3
          names: |
            "${{ steps.pom-info.outputs.group-id }}.${{ steps.pom-info.outputs.artifact-id }}"

but when running this action, nothing is deleted and i have this message. whats going wrong in my setting ?

Run smartsquaregmbh/[email protected]
Fetching packages
(node:1689) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Found 0 packages (before filtering)
No packages to delete

Regards,

Laurent

Question: Support for GitHub Container Registry?

I found this project via actions/delete-package-versions#5 (comment).
Thanks a lot for your efforts.

Question

Do you know if this action works also with the (new) GitHub Container Registry?

When you are using GitHub Packages with Docker, it is recommended to use the GitHub Container Registry.
One difference is: The GitHub Container Registry is not bound to a repository. More to an organization.
A relation can be set up to the repository (e.g., via Docker labels).

Usecase

I use GitHub Actions to build new Docker images + push them to the Container Registry on each master push (they also get deployed directly). My goal is to keep the last X versions of an image in the registry.

Keep N most recent AND keep all younger than X days/months ago

Would be great if one could configure it to (1) keep the N most recent versions and (2) keep all younger than X days/months.

I think it's quite common that even if you make 20 releases over two weeks, you don't want to delete them (since they are recent), but when they are a few months old, it's fine to drop 10 of them (and only keep the 10 most recent).

Maybe something to consider?

Thanks for a great action! 🏅

Unsure what is wrong

Hi there, not sure where the best place is to put this question.

First of all thanks for creating this action, I'm surprised how few delete actions there are and that they almost never support a "keep x" feature and they don't allow multiple packages and named versions. So this is perfect!

Now for the puzzling part. I have an action where I've set keep to 5 but I get the error that keep must be an integer between 1 and 20. I have another where I set the version pattern to the exact name of the version (let's say foo-bar) and get no matches like so:

Run smartsquaregmbh/[email protected]
  with:
    keep: 10
    version-pattern: [0-9a-f]{8}
    names: node_build
  lucky_build
  app_server
    token: ***
Error: keep must be an integer between 0 and 20 (inclusive)

In this case the yaml that generated this output was

      - name: clean up old versions
        uses: smartsquaregmbh/[email protected]
        with:
          keep: 10
          # Delete all old images that look like a commit short sha
          version-pattern: "[0-9a-f]{8}"
          names: |
            node_build
            lucky_build
            app_server

For the other case (with the version-pattern issue) I see

Run smartsquaregmbh/[email protected]
  with:
    version-pattern: foo-bar
    names: node_build
  lucky_build
  app_server
  
    token: ***
Fetching packages
No packages to delete

generated by

      - name: delete branch version
        uses: smartsquaregmbh/[email protected]
        with:
          version-pattern: '${{ steps.branch-name.outputs.branch-name }}'
          names: |
            node_build
            lucky_build
            app_server

which is odd since I can see plainly that my node_build image (for example) has a version tag of 'foo-bar'.

When I looked through your code I couldn't see any reason for these failures and I tried various things like using single quotes around values but to no avail.

Any thoughts of something I could try to help debug this?

HttpError: Package not found when trying to delete it

For some reason the action is not able to delete de package,

I am using the version-pattern to filtering and I am able to retrieve the package I want to delete, but when I tries to delete it fails.

Screenshot 2022-12-06 at 17 08 27

I am doing anything wrong? I am 100% sure that the package exists but I don't know why it's not working.

Variable $version of type String!

Run smartsquaregmbh/[email protected]
Warning: Dry run is set. No package versions will be actually deleted.
Fetching packages
Error: Variable $version of type String! was provided invalid value

version value I tried were "3.2-SNAPSHOT", 3.2-SNAPSHOT, '3.2-SNAPSHOT' nothing works.

Feature Request: Dry Run

Would be great if there was a "dry run" mode for this which just printed out which packages would be caught by the filters.

Delete package assets

In case of Java SNAPSHOT dependencies the assets (pom, jar, md5) are still present after the package deletion. The SNAPSHOT is transformed on the actual timestamp so the assets will just accumulate under the same package version.

EG: Below are two builds one at 19:22:52 and one at 19:52:54. The artifacts share the same DEVELOP-SNAPSHOT version.

common-db-plus-DEVELOP-20230124.192254-14.module.sha512
common-db-plus-DEVELOP-20230124.192254-14.module.sha256
common-db-plus-DEVELOP-20230124.192252-14.module.sha512
common-db-plus-DEVELOP-20230124.192254-14.module.md5
common-db-plus-DEVELOP-20230124.192252-14.module.sha256
common-db-plus-DEVELOP-20230124.192254-14.module.sha1
common-db-plus-DEVELOP-20230124.192252-14.module.md5

not working with ghcr.io

Hi there,

it seams that when using this with github container registry the action does not work. We used it with the keep x images and sadly it does nothing.

As mentioned here, ghcr API should be able to handle query and delete requests:
https://github.community/t/you-can-now-delete-and-restore-any-package-type-within-github-packages/162393

Is it maybe caused by an outdated octokit version this action is in use of?

Thanks in advance for taking care of this
(would really like to use this action further)

Deleting Nuget packages not working

Whatever i try it returns "Found 0 package(s) before filtering". What i am doing wrong?
Repository is private.

Package
WHS.Menu.Domain

name: Delete old packages /

on: 
  workflow_dispatch
     
jobs:
  check-dist:
    runs-on: ubuntu-latest

    steps: 
      - name: delete
        uses: smartsquaregmbh/[email protected]
        with:
          keep: 1
          names: WHS.Menu.Domain

Version matching string issues

Seeing this error Error: Variable $version of type String! was provided invalid value for both version: 0.0.0-canary.b455522.20210511151909 as well as version: "0.0.0-canary.b455522.20210511151909". Is this expected? let me know if I'm missing something. I'm excited for this alternative to github actions delete https://github.com/actions/delete-package-versions

- name: Delete one package
  uses: SmartsquareGmbH/[email protected]
  with:
    version: 0.0.0-canary.b455522.20210511151909
    dry-run: true
    names: a11y-testing-block

I was going off of

uses: smartsquaregmbh/[email protected]
with:
  version: foo-bar
  names: |
    package

with quotation marks:
https://github.com/WPMedia/fusion-news-theme-blocks/actions/runs/832800627

without quotation marks:
https://github.com/WPMedia/fusion-news-theme-blocks/runs/2559229760?check_suite_focus=true

Error message when more than 20 messages

I have just taken over managing a GitHub Workflow from a colleague. One of the first thing I did was to add a job to delete, a few more packages (so now there are 39 packages). Then I run into an error and found out that the action works at most with 20 packages. From your readme:

"The action works by getting at most 20 packages with at most the oldest 100 versions of each, applying the filters (see table below) on them and then deleting the matching versions."

My questions:

  1. Why is this limit there? Isn't 20 a bit low?
  2. Isn't it better to check if the limit is exceeded before the action is run and then report a readable error? Something like: "Maximum number of package names is exceeded. 39 package names are listed, but a maximum of 20 is allowed".

In the attached log file the error I now see.
delete_old_packages_error.log

delete packages with 0 downloads

i haven't found a smart way to remove packages with zero downloads, which can happen when you're publishing "canary" versions of packages constantly. Is that something that off the top of your head you can see would be beneficial to add in this library?

Feature Request: Support NuGet version filters

In addition to regex, it would be amazing if this action supported nuget-pattern or similar, which let us use the version-range syntax used by NuGet.

Notation Applied rule Description
1.0 x ≥ 1.0 Minimum version, inclusive
(1.0,) x > 1.0 Minimum version, exclusive
[1.0] x == 1.0 Exact version match
(,1.0] x ≤ 1.0 Maximum version, inclusive
(,1.0) x < 1.0 Maximum version, exclusive
[1.0,2.0] 1.0 ≤ x ≤ 2.0 Exact range, inclusive
(1.0,2.0) 1.0 < x < 2.0 Exact range, exclusive
[1.0,2.0) 1.0 ≤ x < 2.0 Mixed inclusive minimum and exclusive maximum version
(1.0) invalid invalid

Source: https://docs.microsoft.com/en-us/nuget/concepts/package-versioning#version-ranges

Keep N versions of specified version pattern.

Is it possible to keep N versions of the specified version pattern rather than any version.

Scenario:
I would like to delete both old release and pre-release packages. However, with the current set-up there is a possibility of losing either all release or all pre-release packages. This would mainly be used for private packages.

Thanks!

When I specify a static version I get no matches

I have a process where I tag containers with the branch name. I'd like to setup a workflow to delete the tag after the branch is deleted. For some reason this doesn't work (this is a test, the real flow sets version pattern dynamically)

      - uses: smartsquaregmbh/[email protected]
        with:
          version-pattern: "mytag"

Is there something special I need to add to the value to make it work like a regex?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.