{"slug": "migrating-your-github-ci-to-hugging-face-jobs", "title": "Migrating Your GitHub CI to Hugging Face Jobs", "summary": "Hugging Face launched a new GitHub Actions integration that allows developers to run CI jobs on Hugging Face's infrastructure instead of GitHub's default runners. The setup uses a dispatcher Space that receives GitHub webhook events and launches jobs on Hugging Face's hardware, enabling GPU access and faster CPU execution. The Trackio project reported a 30% reduction in CPU CI time and gained the ability to run GPU test suites through this integration.", "body_md": "🏃\n\n#### jobs-actions Dispatcher\n\nRun GitHub Actions on Hugging Face Jobs\n\n`runs-on: ubuntu-latest`\n\n, and GitHub gives you a machine.\nThat default is convenient, but it also has limits. GitHub Actions can be slow or down for maintenance, the hosted machines are generic, and GPU access is not something most open-source projects can just turn on. For [Trackio](https://github.com/gradio-app/trackio), those limits started to matter. We wanted both reliable CPU CI for basic unit tests and frontend checks, but also GPU CI for tests that need to run on actual CUDA hardware.\n\nSo built an alternative: keep GitHub Actions in charge of CI, but run the jobs on [Hugging Face Jobs](https://huggingface.co/docs/hub/en/jobs-overview).\n\nThe result: Trackio's CI now runs on Hugging Face Jobs and streams back real-time logs, **cutting our CI time for CPU jobs by about 30% and enabling a whole new test suite that runs on GPU machines**!\n\nIn this article, we explain step-by-step how to recreate the same setup for your GitHub repo. If you are using an agent, you can point it to this article, since we provide CLI instructions alongside browser-based instructions for us humans.\n\nLet's start with a quick intro to Hugging Face Jobs!\n\n[Hugging Face Jobs](https://huggingface.co/docs/hub/en/jobs-overview) lets you run commands or scripts on Hugging Face's serverless infrastructure with almost any hardware flavor. A Job is essentially:\n\n`t4-small`\n\nor `h200`\n\nGPUFor example, you can run:\n\n```\nhf jobs run python:3.12 python -c \"print('Hello world')\"\n```\n\nor\n\n```\nhf jobs uv run --flavor a10g-small \"https://raw.githubusercontent.com/huggingface/trl/main/trl/scripts/sft.py\"\n```\n\nThat makes Jobs a natural fit for CI. CI jobs are already command-driven, already run in clean environments, and often benefit from choosing exactly the right hardware. For ML libraries, the GPU case is especially compelling: you can run a test suite on real GPU hardware without maintaining your own always-on runner.\n\nThe key step is connecting GitHub Actions to HF Jobs, which we describe below.\n\nFor this setup, we created [ huggingface/jobs-actions](https://github.com/huggingface/jobs-actions), a small bridge that turns a GitHub Actions job into an ephemeral self-hosted runner running inside an HF Job.\n\nThe complete flow looks like this:\n\n`runs-on`\n\nlabel is not available, for example `hf-jobs-cpu-upgrade`\n\nor `hf-jobs-t4-small`\n\n, and sends a signed `workflow_job.queued`\n\nwebhook to the dispatcher through the GitHub App.`hf-jobs-*`\n\nlabel, mints a short-lived GitHub runner registration token, and starts an HF Job on the matching hardware.From GitHub's point of view, this is just a self-hosted runner. From Hugging Face's point of view, it is just a Job that launches a container to run the workflow steps from the repo’s GitHub Actions.\n\nThe first thing you need is the dispatcher. This is a small Docker Space that receives GitHub `workflow_job`\n\nwebhook events and launches HF Jobs in response.\n\nCreate this first because the GitHub App needs a webhook URL, and that URL comes from the Space. This Space should be under your own namespace or under a Hugging Face org that you have write access to.\n\nGo to [ huggingface/jobs-actions-dispatcher](https://huggingface.co/spaces/huggingface/jobs-actions-dispatcher) and click\n\nUse:\n\n```\nOwner: your HF user or org\nName: jobs-actions-dispatcher\nHardware: cpu-upgrade\n```\n\nUse `cpu-upgrade`\n\nfor real CI so the dispatcher stays available for GitHub webhooks. `cpu-basic`\n\nis fine for testing and will probably work, but it can sleep after inactivity; if GitHub's webhook arrives while it is waking up, the workflow may stay queued forever.\n\nAfter it builds, open the duplicated Space. You will see a section that says \"Required Space secrets,\" which you can ignore for now. The landing page should display the GitHub App webhook URL you need in the next step. It will look like this:\n\n```\nhttps://YOUR-HF-NAMESPACE-jobs-actions-dispatcher.hf.space/webhook\n```\n\nIf you'd prefer to set up the dispatcher Space with an agent or use a CLI workflow:\n\n```\nexport HF_NAMESPACE=your-hf-user-or-org\nexport SPACE_ID=\"$HF_NAMESPACE/jobs-actions-dispatcher\"\n\nhf repo duplicate huggingface/jobs-actions-dispatcher \"$SPACE_ID\" \\\n  --type space \\\n  --flavor cpu-upgrade \\\n  --exist-ok\n```\n\nThen set:\n\n```\nexport DISPATCHER_URL=\"https://${HF_NAMESPACE}-jobs-actions-dispatcher.hf.space\"\n```\n\nNext, create and install the GitHub App from the dispatcher Space itself. This App needs permission to listen for queued workflow jobs and create ephemeral self-hosted runner registration tokens.\n\nOpen your duplicated dispatcher Space:\n\n```\nhttps://YOUR-HF-NAMESPACE-jobs-actions-dispatcher.hf.space\n```\n\nIn the setup form, enter the GitHub repo whose CI should run on HF Jobs:\n\n```\nYOUR-GITHUB-ORG/YOUR-REPO\n```\n\nThen click the button to create the GitHub App. GitHub will ask you to choose a name for the App; the name can be anything, as long as it is available in your GitHub account or org. After you submit, the final screen tells you exactly how to upload the App credentials to the dispatcher Space with the `hf`\n\nCLI.\n\n**Important note**: you will need to provide an [Hugging Face token](https://huggingface.co/settings/tokens) that has permissions to launch Jobs, corresponding to your personal account or an org under which Jobs should be charged. This token should be saved as the `HF_TOKEN`\n\nsecret in your dispatcher Space.\n\nFinally, you will install the App on the same GitHub repo you entered in the Space. In the Trackio setup, we installed it on `gradio-app/trackio`\n\n.\n\nThe GitHub App manifest flow is still browser-based, but an agent can follow the same Space-driven path:\n\n```\nexport HF_NAMESPACE=your-hf-user-or-org\nexport GITHUB_REPO=YOUR-GITHUB-ORG/YOUR-REPO\nopen \"https://${HF_NAMESPACE}-jobs-actions-dispatcher.hf.space\"\n```\n\nPaste `$GITHUB_REPO`\n\ninto the Space, click the GitHub App creation button, choose any available App name, and follow the generated GitHub instructions.\n\nAfter the App exists, install it on your repo from the App settings page. For a GitHub org, the installation settings are under:\n\n```\nhttps://github.com/organizations/YOUR-GITHUB-ORG/settings/installations\n```\n\nAt this point, the dispatcher Space should be configured. The GitHub App setup flow generated the commands that upload the App credentials, webhook secret, and Hugging Face token to the Space.\n\nBy default, HF Jobs are launched under the same namespace as the dispatcher Space. Optionally, set `HF_NAMESPACE`\n\nas a Space variable if you want to bill jobs to a different Hugging Face user or org:\n\n```\nexport SPACE_ID=YOUR-HF-NAMESPACE/jobs-actions-dispatcher\nhf spaces variables add \"$SPACE_ID\" -e HF_NAMESPACE=your-billing-namespace\nhf spaces restart \"$SPACE_ID\"\n```\n\nThe token you set in Step 2 should correspond to this namespace.\n\n`runs-on`\n\nThe actual workflow change is small. Instead of:\n\n```\nruns-on: ubuntu-latest\n```\n\nuse one of the labels handled by the dispatcher:\n\n```\nruns-on: hf-jobs-cpu-upgrade\n```\n\nFor GPU tests, use a GPU label:\n\n```\nruns-on: hf-jobs-t4-small\n```\n\nFor any GitHub Action you'd like to run on HF Jobs, this 1-line change is all you need!\n\nTo add a minimal smoke-test workflow from the CLI:\n\n```\nmkdir -p .github/workflows\ncat > .github/workflows/hf-jobs-test.yml <<'EOF'\nname: HF Jobs Test\n\non:\n  pull_request:\n  push:\n    branches: [main]\n  workflow_dispatch:\n\njobs:\n  test:\n    runs-on: hf-jobs-cpu-upgrade\n    steps:\n      - uses: actions/checkout@v4\n      - run: echo \"Hello from Hugging Face Jobs\"\nEOF\n\ngit add .github/workflows/hf-jobs-test.yml\ngit commit -m \"Run CI on Hugging Face Jobs\"\ngit push\n```\n\nTo verify from the CLI:\n\n```\ngh run list --repo YOUR-GITHUB-ORG/YOUR-REPO --limit 5\nhf jobs ps --namespace \"$HF_NAMESPACE\"\nhf spaces logs \"$SPACE_ID\"\n```\n\nYou should be able to see logs just like a regular GitHub Action—for example, in this [Trackio PR #565](https://github.com/gradio-app/trackio/pull/565).\n\nAnd that's it!\n\n*Note on choosing the right Docker image*\n\nOur first CPU setup used `ubuntu:22.04`\n\nand installed missing system packages during every run. That worked, but it was slower than it needed to be. GitHub's `ubuntu-latest`\n\nimage includes a lot of developer tooling by default; a bare Ubuntu image does not.\n\nFor Trackio, the UI tests need Playwright browsers, Node, ffmpeg, sqlite, git, and normal Linux build dependencies. Hugging Face Jobs supports using any [Docker image](https://huggingface.co/docs/hub/jobs-popular-images), so we switched to the Microsoft Playwright image, which worked well:\n\n```\nmcr.microsoft.com/playwright:v1.60.0-jammy\n```\n\nFor GPU jobs, we used:\n\n```\nnvidia/cuda:12.4.0-runtime-ubuntu22.04\n```\n\nHere are the numbers from the Trackio CI:\n\n| Runner setup | Runtime | Compared to GitHub average |\n|---|---|---|\nGitHub `ubuntu-latest` baseline |\n`1m40s` |\nbaseline |\n| HF Jobs CPU, Playwright image | `1m10s` |\n`-30s` , about `30%` faster |\nHF Jobs GPU, `t4-small` label |\n`45s` |\nno GitHub-hosted GPU baseline |\n\nThe biggest win was GPU CI. The Trackio GPU check ran on HF Jobs and passed in `45s`\n\n, costing less than a cent at the `t4-small`\n\nrate for that duration.\n\nThe CPU result was also encouraging. With the right image, the Linux test job was faster than the GitHub-hosted baseline. That suggests HF Jobs can be a practical CI backend, especially for ML projects that need custom images or accelerators.\n\nLogs were another pleasant surprise. GitHub Actions logs are useful, but the web UI can be heavy for large logs. HF Jobs logs are easy to fetch from the CLI:\n\n```\nhf jobs logs <job_id> > logs.txt\n```\n\nThat makes them easy to inspect with local tools or coding agents. In our bridge, we also mirrored the GitHub Actions job log into the HF Job log, so either system had enough information to debug a run.\n\nFinally, although we didn't need them for Trackio's CI, HF Jobs also [supports mounting volumes](https://huggingface.co/docs/huggingface_hub/en/guides/jobs#mount-a-volume), which can be very helpful if you need to load datasets or models from Hugging Face quickly as part of your CI.\n\nHopefully, this gives you all you need to try HF Jobs for running your GitHub Actions!\n\nRun GitHub Actions on Hugging Face Jobs", "url": "https://wpnews.pro/news/migrating-your-github-ci-to-hugging-face-jobs", "canonical_source": "https://huggingface.co/blog/github-ci-hf-jobs", "published_at": "2026-06-09 00:00:00+00:00", "updated_at": "2026-06-11 21:43:42.340574+00:00", "lang": "en", "topics": ["mlops", "ai-infrastructure", "ai-tools", "machine-learning"], "entities": ["Hugging Face", "GitHub", "Trackio", "GitHub Actions", "Hugging Face Jobs"], "alternates": {"html": "https://wpnews.pro/news/migrating-your-github-ci-to-hugging-face-jobs", "markdown": "https://wpnews.pro/news/migrating-your-github-ci-to-hugging-face-jobs.md", "text": "https://wpnews.pro/news/migrating-your-github-ci-to-hugging-face-jobs.txt", "jsonld": "https://wpnews.pro/news/migrating-your-github-ci-to-hugging-face-jobs.jsonld"}}