I want to create a workflow that should delete all packages for the project I provided.It must look like - I manually run wf, and type the package name that I need to clear.
I found very good custom action, but for one run it removes only 99 packages, I need to remove all of them (after many years of developing our project I have 150+ pages of nuget packages for each sub-project).
How I resolved this task - I created this action :
name: RemovePackageson: workflow_dispatch: inputs: package_name: description: 'Package name to remove' required: truejobs: remove-packages: name: remove-packages runs-on: ubuntu-latest steps: - uses: actions/delete-package-versions@v3 id: delete-package-step with: package-name: '${{ github.event.inputs.package_name }}' min-versions-to-keep: 0 dispatch-remove-job: runs-on: ubuntu-latest needs: [ remove-packages ] steps: - name: run-job-again run: | curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token my_token_123" https://api.github.com/repos/owner/project/actions/workflows/remove-package.yml/dispatches -d '{"ref": "add-remove-packages-workflow", "inputs": {"package_name": "${{ github.event.inputs.package_name }}"}}'
So, it will runs a lot of time recursively, but how to stop it?I need to check output of "delete-package-step", if it contains "not found" then don't dispatch new delete workflow.
I know that I can run command through echo, but I don't know how to do it with uses statement and its arguments.