# GitHub Actions integration

Integrations / CI. Breadcrumb: [Home](https://osty.dev/) / [Integrations](https://osty.dev/integrations) / GitHub Actions

Two workflow steps connect GitHub Actions to Osty. `osty verify` fails the job when the lockfile resolves a blocked version or one without a signed verdict, and `osty stamp` signs an Ed25519 attestation that ties the image digest to the commit and run. Both commands ship in the `osty` CLI (Apache 2.0 source).

Table: What each GitHub Actions step does

| Step | Command | Fails the job when | Reads from GitHub Actions |
| --- | --- | --- | --- |
| Policy check | `osty policy validate .osty/policy.yaml` | The policy has a schema or semantic error. | Nothing. |
| Lockfile gate | `osty verify --lockfile package-lock.json` | A dependency is blocked, or has no verified verdict under `FAIL_CLOSED`. | `OSTY_EDGE_CACHE` and `OSTY_POLICY_PATH` from `env`. |
| Provenance | `osty stamp --artifact-digest <sha256> --signing-key <pem>` | The digest, key or detected CI context is invalid. | `GITHUB_REPOSITORY`, `GITHUB_SHA`, `GITHUB_RUN_ID`, `GITHUB_RUN_ATTEMPT`, `GITHUB_SERVER_URL`. |
| Attestation check | `osty stamp verify --attestation provenance.json --public-key stamp.pub.pem` | The signature or digest does not match. | Nothing. |

The lockfile gate, as one CI step:

```bash
osty verify --lockfile package-lock.json --json
```

## What do I need before adding the workflow?

- A Go 1.26 toolchain on the runner to install the pure-Go `osty` binary (`CGO_ENABLED=0`).
- A signed verdict cache. `osty-edge` keeps one at `--cache-path`; a self-hosted runner on the edge host can read it directly.
- A committed `.osty/policy.yaml`. See [Policy and Ledger](https://osty.dev/policy-ledger) for the schema.
- For provenance, an Ed25519 key pair from `osty stamp keygen`, with the private key stored as the `OSTY_STAMP_KEY` secret.

Create the stamp signing key once:

```bash
osty stamp keygen --private-key stamp.pem --public-key stamp.pub.pem
```

## How do I gate pull requests with osty verify?

The job runs on a self-hosted runner labelled `osty-edge` that can read the edge cache. `osty verify` reads `OSTY_EDGE_CACHE` and `OSTY_POLICY_PATH` when `--cache` and `--policy` are omitted, and accepts `package-lock.json`, `go.sum`, `go.mod`, `requirements.txt` and `uv.lock`.

`.github/workflows/osty-verify.yml`:

```yaml
name: osty-verify
on:
  pull_request:
  push:
    branches: [main]
permissions:
  contents: read
jobs:
  verify:
    runs-on: [self-hosted, linux, osty-edge]
    env:
      OSTY_EDGE_CACHE: /var/lib/osty/edge-cache.sqlite
      OSTY_POLICY_PATH: .osty/policy.yaml
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: "1.26"
      - name: Install osty
        run: CGO_ENABLED=0 go install github.com/osty-io/osty/cmd/osty@latest
      - name: Validate policy
        run: osty policy validate .osty/policy.yaml
      - name: Verify lockfile against signed verdicts
        run: osty verify --lockfile package-lock.json --json
```

Run self-hosted runners only on repositories that do not build pull requests from forks, so untrusted code never executes next to the edge cache.

### Why does an empty cache fail the build?

With `proxyFailureMode.prodCI: FAIL_CLOSED`, a version with no verified verdict in the cache is held. The job prints the reason and exits non-zero:

`osty verify` output with no verdict cached:

```text
verified package-lock.json (NPM_PACKAGE_LOCK): total=1 allowed=0 quarantined=1 blocked=0
  NPM left-pad@1.3.0 [PULL_DECISION_QUARANTINE_HOLD/SUPPLY_CHAIN_VERDICT_UNSPECIFIED]: no verified verdict in local cache; policy failure mode FAIL_CLOSED blocks unvetted pull
osty verify: lockfile verification blocked one or more dependencies
```

### Can I use GitHub-hosted runners?

Yes, if the job first imports a signed intelligence archive into a local cache. `osty airgap import` verifies every bundle against the brain public key before writing.

Build a local cache from a signed archive:

```bash
osty airgap import --archive osty-intel.tar.gz --brain-public-key brain.pub.pem --cache "$RUNNER_TEMP/edge-cache.sqlite"
osty verify --lockfile package-lock.json --cache "$RUNNER_TEMP/edge-cache.sqlite" --json
```

### Is there a published GitHub Action?

Yes. [osty-dev/osty-action](https://github.com/osty-dev/osty-action) is an Apache 2.0 action that installs the `osty` CLI, runs `osty policy validate` and `osty verify`, and can sign provenance with `osty stamp`. It writes the verdict counts to step outputs and a Markdown table to the job summary.

Steps that gate the lockfile with `osty-dev/osty-action@v1`:

```yaml
steps:
  - uses: actions/checkout@v4
  - id: osty
    uses: osty-dev/osty-action@v1
    with:
      lockfile: package-lock.json
      cache: .osty/edge-cache.sqlite
```

Pass `airgap-archive` and `airgap-brain-public-key` instead of `cache` to import a signed intelligence archive on a GitHub-hosted runner, and `fail-on-block: "false"` to record the verdict without failing the job.

## How do I sign build provenance with osty stamp?

Run `osty stamp` after the image push. It detects GitHub Actions from `GITHUB_ACTIONS=true` and fills repository, commit, run ID and run URL, so only the artifact digest and signing key are required. Pass `--base-image-digest` to record base-image lineage.

`.github/workflows/build-and-stamp.yml`:

```yaml
name: build-and-stamp
on:
  push:
    branches: [main]
permissions:
  contents: read
  packages: write
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: "1.26"
      - name: Install osty
        run: CGO_ENABLED=0 go install github.com/osty-io/osty/cmd/osty@latest
      - uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - id: push
        uses: docker/build-push-action@v6
        with:
          push: true
          tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
      - name: Stamp provenance
        env:
          IMAGE_DIGEST: ${{ steps.push.outputs.digest }}
          OSTY_STAMP_KEY: ${{ secrets.OSTY_STAMP_KEY }}
        run: |
          printf '%s\n' "$OSTY_STAMP_KEY" > "$RUNNER_TEMP/stamp.pem"
          osty stamp --artifact-digest "$IMAGE_DIGEST" --signing-key "$RUNNER_TEMP/stamp.pem" --out provenance.json
      - uses: actions/upload-artifact@v4
        with:
          name: osty-provenance
          path: provenance.json
```

Verify the attestation anywhere, offline:

```bash
osty stamp verify --attestation provenance.json --public-key stamp.pub.pem --artifact-digest "$IMAGE_DIGEST"
```

## How does Osty classify these workflows before speculative CI?

Before Osty pushes a speculative branch, `osty-edge` classifies every workflow the push would trigger. Only `PURE_VERIFY` workflows run remotely by default. These are the classifier's real results for the two files above:

Table: Classifier output for the two workflows on this page

| Workflow | Class | Reasons reported |
| --- | --- | --- |
| `osty-verify.yml` | `SIDE_EFFECT_POSSIBLE` | The `go install`, `osty policy validate` and `osty verify` run steps are opaque commands the classifier cannot prove side-effect free. |
| `build-and-stamp.yml` | `SIDE_EFFECT_CONFIRMED` | `docker/login-action`, `docker/build-push-action` with `push: true`, and shell output redirection. |

A `SIDE_EFFECT_CONFIRMED` workflow never runs speculatively. A `SIDE_EFFECT_POSSIBLE` workflow runs remotely only when its path, name or file name appears in `ciGovernor.safeVerifyWorkflows`; otherwise Osty verifies inside the edge's local container. Repository overlays may only narrow that list.

`ciGovernor` section of `.osty/policy.yaml`:

```yaml
ciGovernor:
  maxConcurrentCampaignRuns: 10
  routineBudgetPercent: 20
  kevBurstBudgetPercent: 60
  flakeControlRerun: true
  safeVerifyWorkflows:
    - .github/workflows/osty-verify.yml
```

## Frequently asked questions

### Is there a published GitHub Action for Osty?

Yes. Use `uses: osty-dev/osty-action@v1` from [osty-dev/osty-action](https://github.com/osty-dev/osty-action), or install the CLI with `go install` as shown and bake it into your runner image.

### Which lockfiles does `osty verify` read?

`package-lock.json`, `go.sum`, `go.mod`, `requirements.txt` and `uv.lock`.

### Does `osty stamp` need network access?

No. It signs locally with your key and writes the attestation to stdout or `--out`.

### Why is my verify workflow not `PURE_VERIFY`?

The classifier treats run steps it cannot prove read-only as opaque. Add the workflow path to `ciGovernor.safeVerifyWorkflows` after review.

## Related pages

- [Guard](https://osty.dev/guard): Pre-install supply-chain firewall: Firecracker honey-secret detonation, artifact-vs-Git diffs, behavior baselines, dependency-confusion defense and `osty-proxy`.
- [See](https://osty.dev/see): Runtime-to-source lineage, `osty stamp` provenance, stale deploy detection, ghost production workloads and native-compiler reachability.
- [CircleCI integration](https://osty.dev/integrations/circleci): The same gate and provenance steps with CircleCI auto-detection.
- [Osty vs Dependabot](https://osty.dev/compare/osty-vs-dependabot): Gate Dependabot pull requests with signed verdicts.

## See your fleet in 10 minutes

Connect a read-only GitHub App and cloud role. Osty installs nothing in your environment and writes nothing to your repositories, and the report shows false positives, stale deploys and unowned workloads.

Get a free X-Ray: https://osty.dev/xray

Written by Osty Engineering. Published 2026-11-29. Updated 2026-11-29.

Canonical: https://osty.dev/integrations/github-actions
