{"id":41374556,"url":"https://github.com/fchimpan/gh-slimify","last_synced_at":"2026-03-04T02:11:45.618Z","repository":{"id":323122873,"uuid":"1092169841","full_name":"fchimpan/gh-slimify","owner":"fchimpan","description":"🚀 Automatically detect and migrate GitHub Actions workflows to `ubuntu-slim` for cost-efficient CI","archived":false,"fork":false,"pushed_at":"2026-02-27T00:55:58.000Z","size":678,"stargazers_count":100,"open_issues_count":2,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-01T08:36:09.317Z","etag":null,"topics":["ci","cli","gh-extension","gh-extensions","github-actions"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fchimpan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-08T05:49:26.000Z","updated_at":"2026-02-27T03:22:15.000Z","dependencies_parsed_at":"2026-02-01T20:02:10.380Z","dependency_job_id":null,"html_url":"https://github.com/fchimpan/gh-slimify","commit_stats":null,"previous_names":["fchimpan/gh-slimify"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/fchimpan/gh-slimify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fchimpan%2Fgh-slimify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fchimpan%2Fgh-slimify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fchimpan%2Fgh-slimify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fchimpan%2Fgh-slimify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fchimpan","download_url":"https://codeload.github.com/fchimpan/gh-slimify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fchimpan%2Fgh-slimify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30069420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T01:03:42.280Z","status":"online","status_checked_at":"2026-03-04T02:00:07.464Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci","cli","gh-extension","gh-extensions","github-actions"],"created_at":"2026-01-23T10:00:30.291Z","updated_at":"2026-03-04T02:11:45.589Z","avatar_url":"https://github.com/fchimpan.png","language":"Go","funding_links":[],"categories":["🧩 Categories","Go","Actions/CI"],"sub_categories":["Automation / DevOps"],"readme":"# gh-slimify\n\n[![Go Version](https://img.shields.io/badge/go-1.25.3-blue.svg)](https://golang.org)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n[![GitHub CLI](https://img.shields.io/badge/gh-cli-blue.svg)](https://cli.github.com)\n\n\u003e[!WARNING] \n\u003eMigrating to `ubuntu-slim` may cause workflow instability or increased execution time.\n\n![gh-slimify scan output](images/demo.gif)\n\n\u003e [!TIP] \n\u003e 💡 Wait, couldn't you just copy-paste the following prompt into AI agent and skip using this tool altogether? 🤔\n\u003e ```md\n\u003e Goal: For every workflow file under `.github/workflows`, migrate jobs that currently run on `ubuntu-latest` to the container-based runner `ubuntu-slim`. Use the following decision rules in order when judging whether to migrate a job:\n\u003e \n\u003e 1. Only consider jobs (including matrix entries) whose `runs-on` is `ubuntu-latest` or `ubuntu-24.04`.\n\u003e 2. Skip any job that uses service containers (`jobs.\u003cjob_id\u003e.services`).\n\u003e 3. Skip any job already running inside a container (`jobs.\u003cjob_id\u003e.container`).\n\u003e 4. Skip any job whose setup steps provision an environment that assumes a non-container host.\n\u003e 5. Skip any job whose run scripts rely on host-only commands or elevated system privileges that containers cannot provide (e.g., `systemctl`, `systemd`, etc.).\n\u003e 6. Skip any job whose execution time exceeds 15 minutes. Use the GitHub CLI to check the duration of the most recent successful run. Example commands:\n\u003e \n\u003e    ```bash\n\u003e    # Get the database ID of the latest successful run\n\u003e    id=$(gh run list \\\n\u003e      --repo ${owner}/${repo} \\\n\u003e      --workflow ${workflow_file_name} \\\n\u003e      --status success \\\n\u003e      --limit 1 \\\n\u003e      --json databaseId | jq .'[0].databaseId')\n\u003e \n\u003e    # List jobs from that run to inspect start/completion times\n\u003e    gh api \\\n\u003e      repos/{owner}/{repo}/actions/runs/${id}/jobs | jq '.jobs[] | {name: .name, started_at: .started_at, completed_at: .completed_at}'\n\u003e \n\u003e Based on these rules, review each workflow and migrate every eligible job to ubuntu-slim. Afterward, report both the jobs that were successfully migrated and, for those that were not, the specific reasons they were ineligible.\n\u003e ```\n\n## 🎯 Motivation\n\nGitHub Actions recently [introduced the lightweight `ubuntu-slim` runner](https://github.blog/changelog/2025-10-28-1-vcpu-linux-runner-now-available-in-github-actions-in-public-preview/) (1 vCPU / 5 GB RAM, max 15 min runtime) as a cost-efficient alternative to `ubuntu-latest`. However, manually identifying which workflows can safely migrate is tedious and error-prone:\n\n- ❌ Jobs using Docker commands or containers cannot migrate\n- ❌ Jobs using `services:` containers are incompatible\n- ❌ Jobs exceeding 15 minutes will fail\n- ❌ Container-based GitHub Actions are not supported\n\n**`gh-slimify` automates this entire process**, analyzing your workflows and safely migrating eligible jobs with a single command.\n\n## 📦 Installation\n\nInstall as a GitHub CLI extension:\n\n```bash\ngh extension install fchimpan/gh-slimify\n```\n\n\u003e [!NOTE]\n\u003e At the time of writing, GitHub has not officially published a list of tools pre-installed on `ubuntu-slim` runners. Therefore, the tool detection for missing commands is **uncertain** and based on assumptions. The tool may incorrectly flag commands as missing (false positives) or miss commands that are actually missing (false negatives). Always verify manually before migrating critical workflows.\n\n## 🚀 Quick Start\n\n\u003e [!IMPORTANT]\n\u003e All commands must be executed from the **repository root directory** (where `.github/workflows/` is located).\n\nGet help:\n\n```bash\n$ gh slimify --help\n```\n\n### Scan Workflows\n\nScan specific workflow file(s) to find migration candidates:\n\n```bash\ngh slimify .github/workflows/ci.yml\n```\n\nOr scan multiple workflow files:\n\n```bash\ngh slimify .github/workflows/ci.yml .github/workflows/test.yml\n```\n\nTo scan all workflows in `.github/workflows/`, use the `--all` flag:\n\n```bash\ngh slimify --all\n```\n\n**Example Output:**\n\n```\n📄 .github/workflows/lint.yml\n  ✅ Safe to migrate (1 job(s)):\n     • \"lint\" (L8) - Last execution time: 4m\n       .github/workflows/lint.yml:8\n  ⚠️  Can migrate but requires attention (1 job(s)):\n     • \"build\" (L15)\n       ⚠️  Setup may be required (go), Last execution time: unknown\n       .github/workflows/lint.yml:15\n  ❌ Cannot migrate (2 job(s)):\n     • \"docker-build\" (L25)\n       ❌ uses Docker commands\n       .github/workflows/lint.yml:25\n     • \"test-with-db\" (L35)\n       ❌ uses service containers\n       .github/workflows/lint.yml:35\n\n✅ 1 job(s) can be safely migrated\n⚠️  1 job(s) can be migrated but require attention\n❌ 2 job(s) cannot be migrated\n📊 Total: 2 job(s) eligible for migration\n```\n\nThe output shows:\n- **✅ Safe to migrate**: Jobs with no missing commands and known execution time\n- **⚠️ Can migrate but requires attention**: Jobs with missing commands or unknown execution time\n- **❌ Cannot migrate**: Jobs that cannot be migrated with specific reasons (e.g., uses Docker commands, uses service containers, uses container syntax, does not run on ubuntu-latest)\n- **Warning reasons**: Displayed in a single line for easy understanding\n- **Relative file paths**: Clickable links that work in VS Code, iTerm2, and other terminal emulators\n\n### Auto-Fix Workflows\n\nAutomatically update eligible jobs to use `ubuntu-slim`. By default, only safe jobs (no missing commands and known execution time) are updated.\n\nSpecify workflow file(s):\n\n```bash\ngh slimify fix .github/workflows/ci.yml\n```\n\nOr use `--all` to fix all workflows:\n\n```bash\ngh slimify fix --all\n```\n\n**Example Output (default - safe jobs only):**\n\n```\nUpdating workflows to use ubuntu-slim (safe jobs only)...\nSkipping 1 job(s) with warnings. Use --force to update them.\n\nUpdating .github/workflows/lint.yml\n  ✓ Updated job \"lint\" (L8) → ubuntu-slim\n\nSuccessfully updated 1 job(s) to use ubuntu-slim.\n```\n\nTo also update jobs with warnings (missing commands or unknown execution time), use the `--force` flag:\n\n```bash\ngh slimify fix --force\n```\n\n**Example Output (with --force):**\n\n```\nUpdating workflows to use ubuntu-slim (including jobs with warnings)...\n\nUpdating .github/workflows/lint.yml\n  ⚠️  Updated job \"build\" (L15) → ubuntu-slim (with warnings)\n  ✓ Updated job \"lint\" (L8) → ubuntu-slim\n\nSuccessfully updated 2 job(s) to use ubuntu-slim.\n```\n\n## 📖 Usage\n\n### Scan All Workflows\n\nTo scan all workflows in `.github/workflows/`, use the `--all` flag:\n\n```bash\ngh slimify --all\n```\n\n### Using --file Flag\n\nYou can also use the `--file` (or `-f`) flag to specify workflow files:\n\n```bash\ngh slimify -f .github/workflows/ci.yml -f .github/workflows/test.yml\n```\n\n### Skip Duration Check\n\nSkip fetching job durations from GitHub API. This is useful for:\n- **API rate limit management**: Avoid hitting GitHub API rate limits when scanning many workflows\n- **Faster scans**: Skip API calls for quicker results\n- **When API access is unavailable**: Use when GitHub API is not accessible\n\n```bash\ngh slimify --skip-duration\n```\n\nUse the `--verbose` flag to enable debug output, which can help troubleshoot issues with API calls or workflow parsing:\n\n```bash\ngh slimify --verbose\n```\n\n### Force Update Jobs with Warnings\n\nUpdate jobs with warnings (missing commands or unknown execution time):\n\n```bash\ngh slimify fix --force\n```\n\n### Combine Options\n\n```bash\ngh slimify fix .github/workflows/ci.yml --skip-duration --force\ngh slimify --all --skip-duration\ngh slimify fix --all --force\n```\n\n## 🔍 Migration Criteria\n\nA job is eligible for migration to `ubuntu-slim` if **all** of the following conditions are met:\n\n1. ✅ Runs on `ubuntu-latest`\n2. ✅ Does **not** use Docker commands (`docker build`, `docker run`, `docker compose`, etc.)\n3. ✅ Does **not** use Docker-based GitHub Actions (e.g., `docker/build-push-action`, `docker/login-action`)\n4. ✅ Does **not** use `services:` containers (PostgreSQL, Redis, MySQL, etc.)\n5. ✅ Does **not** use `container:` syntax (jobs running inside Docker containers)\n6. ✅ Latest workflow run duration is **under 15 minutes** (checked via GitHub API)\n7. ⚠️ Jobs using commands that exist in `ubuntu-latest` but not in `ubuntu-slim` (e.g. `nvm`) will be flagged with warnings but are still eligible for migration. You may need to add setup steps to install these tools in `ubuntu-slim`.\n\n\u003e [!NOTE]\n\u003e **Setup Action Detection**: If a job uses popular setup actions from GitHub Marketplace (e.g., `actions/setup-go`,`hashicorp/setup-terraform`), the commands provided by those actions (e.g., `go`, `terraform`) will **not** be flagged as missing. This is because these setup actions install the necessary tools, making the job safe to migrate. The tool recognizes setup actions from GitHub Marketplace's verified creators, including official GitHub actions and popular third-party actions.\n\nIf any condition is violated, the job will **not** be migrated.\n\n### Job Status Classification\n\nJobs are classified into three categories:\n\n- **✅ Safe to migrate**: No missing commands and execution time is known\n- **⚠️ Can migrate but requires attention**: Has missing commands or execution time is unknown\n- **❌ Cannot migrate**: Does not meet migration criteria (e.g., uses Docker commands, uses service containers, uses container syntax, does not run on ubuntu-latest)\n\nMissing commands are tools that exist in `ubuntu-latest` but need to be installed in `ubuntu-slim` (e.g., `nvm`). These jobs can still be migrated, but you may need to add setup steps to install the required tools.\n\nWhen a job cannot be migrated, the specific reason(s) are displayed, such as:\n- \"does not run on ubuntu-latest\"\n- \"uses Docker commands\"\n- \"uses container-based GitHub Actions\"\n- \"uses service containers\"\n- \"uses container syntax\"\n\n## 📝 Examples\n\n### Example 1: Simple Lint Job ✅\n\n```yaml\njobs:\n  lint:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n      - run: npm run lint\n```\n\n### Example 2: Docker Build Job ❌\n\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: docker/build-push-action@v6\n        with:\n          context: .\n          push: true\n```\n\n**Result:** ❌ Not eligible — Uses Docker-based action\n\n### Example 3: Job with Services ❌\n\n```yaml\njobs:\n  test:\n    runs-on: ubuntu-latest\n    services:\n      postgres:\n        image: postgres:14\n    steps:\n      - run: npm test\n```\n\n**Result:** ❌ Not eligible — Uses `services:` containers\n\n### Example 4: Container Job ❌\n\n```yaml\njobs:\n  test:\n    runs-on: ubuntu-latest\n    container:\n      image: node:18\n    steps:\n      - run: node --version\n```\n\n**Result:** ❌ Not eligible — Uses `container:` syntax\n\n## 🛠️ How It Works\n\n1. **Parse Workflows**: Scans `.github/workflows/*.yml` files and parses job definitions\n2. **Check Criteria**: Evaluates each job against migration criteria (Docker, services, containers)\n3. **Detect Missing Commands**: Identifies commands used in jobs that exist in `ubuntu-latest` but not in `ubuntu-slim`\n4. **Fetch Durations**: Retrieves latest job execution times from GitHub API (unless `--skip-duration` is used)\n5. **Classify Jobs**: Separates jobs into \"safe\" (no warnings), \"requires attention\" (has warnings), and \"cannot migrate\" (does not meet criteria) categories\n6. **Report Results**: Displays eligible jobs grouped by status with:\n   - Visual indicators (✅ for safe, ⚠️ for warnings, ❌ for ineligible)\n   - Ineligibility reasons for jobs that cannot be migrated\n   - Warning reasons in a single line\n   - Relative file paths with line numbers (clickable in most terminals)\n   - Execution durations\n7. **Auto-Fix** (optional): Updates `runs-on: ubuntu-latest` to `runs-on: ubuntu-slim`:\n   - By default: Only safe jobs are updated\n   - With `--force`: All eligible jobs (including those with warnings) are updated\n\n\n## 📄 License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffchimpan%2Fgh-slimify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffchimpan%2Fgh-slimify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffchimpan%2Fgh-slimify/lists"}