Compare commits

..

8 Commits

Author SHA1 Message Date
ff8cd3350b Added more debugging
All checks were successful
Build on push / prepare (push) Successful in 6s
Build on push / build (push) Successful in 18s
2026-02-15 12:49:58 +01:00
7e4abe9efd Readded delete function
All checks were successful
Build on push / prepare (push) Successful in 6s
Build on push / build (push) Successful in 19s
2026-02-15 12:46:24 +01:00
706d9f89f0 Fixed download url of cleanup tool
All checks were successful
Build on push / prepare (push) Successful in 27s
Build on push / build (push) Successful in 30s
2026-02-15 12:42:40 +01:00
a2e4152d5e Should fix exec problems
All checks were successful
Build on push / prepare (push) Successful in 27s
Build on push / build (push) Successful in 28s
2026-02-15 12:24:00 +01:00
4497b67b70 force dry run via start arg
All checks were successful
Build on push / prepare (push) Successful in 20s
Build on push / build (push) Successful in 39s
2026-02-15 12:17:45 +01:00
c1a882d1a2 Cleanup to ensure repull
All checks were successful
Build on push / prepare (push) Successful in 30s
Build on push / build (push) Successful in 40s
2026-02-15 12:12:52 +01:00
3ba2b71f4a Hold to debug
All checks were successful
Build on push / prepare (push) Successful in 8s
Build on push / build (push) Successful in 21s
2026-02-15 12:08:45 +01:00
17a4e57fa4 Added test output
All checks were successful
Build on push / prepare (push) Successful in 6s
Build on push / build (push) Successful in 19s
2026-02-15 12:07:19 +01:00
3 changed files with 23 additions and 11 deletions

View File

@@ -23,21 +23,19 @@ inputs:
required: false
default: "false"
outputs:
deleted_packages:
description: "Number of packages deleted"
value: ${{ steps.cleanup.outputs.deleted_packages }}
processed_names:
description: "Number of package names processed"
value: ${{ steps.cleanup.outputs.processed_names }}
runs:
using: "composite"
steps:
- name: Download and test package-cleanup tool
shell: bash
run: |
curl -OJ https://git.sh-edraft.de/api/packages/sh-edraft.de/generic/package-cleanup/package-cleanup-linux-x64
latest_path=$(curl -sI https://git.sh-edraft.de/sh-edraft.de/-/packages/generic/package-cleanup/ \
| awk -F ' ' '/Location:/ {print $2}' \
| tr -d '\r')
version=$(basename "$latest_path")
echo "Downloading package-cleanup version $version..."
curl -OJ https://git.sh-edraft.de/api/packages/sh-edraft.de/generic/package-cleanup/$version/package-cleanup-linux-x64
# Make executable
chmod +x package-cleanup-linux-x64
@@ -54,6 +52,5 @@ runs:
DRY_RUN: ${{ inputs.dry_run }}
GITHUB_OUTPUT: ${{ env.GITHUB_OUTPUT }}
run: |
echo "Starting cleanup..."
./package-cleanup-linux-x64
echo "Cleanup completed."

View File

@@ -3,6 +3,13 @@ using sh.actions.package_cleanup.Service;
var builder = Host.CreateApplicationBuilder(args);
// Check for --dry-run argument
var isDryRun = args.Contains("--dry-run");
if (isDryRun)
{
Environment.SetEnvironmentVariable("DRY_RUN", "true");
}
builder.Configuration
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile("appsettings.local.json", optional: true, reloadOnChange: true)

View File

@@ -17,6 +17,8 @@ public class Worker(
if (dryRun)
{
logger.LogInformation("Dry run enabled, not deleting {Count} packages", packages.Count);
logger.LogInformation("Would delete packages: {versions}",
string.Join(", ", packages.Select(p => p.Version)));
}
foreach (var giteaPackage in packages)
@@ -37,6 +39,12 @@ public class Worker(
{
try
{
var dryRun = configuration["DRY_RUN"]?.ToLower() == "true";
if (dryRun)
{
logger.LogInformation("DRY RUN MODE ENABLED - No packages will be deleted");
}
// Parse comma-separated names
var names = (configuration["NAMES"] ?? "")
.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);