Skip to main content
Plans: Every plan. Who: an owner or admin creates the API token; anyone who can edit the repository’s workflows adds the step.
This workflow generates a CycloneDX JSON SBOM with anchore/sbom-action (Syft) whenever you publish a release, and sends it to Pharus. It is the same workflow as the GitHub Actions tab of Connect a pipeline on the SBOMs page.

Before you start

1

Create a token

In Pharus, go to Settings → API tokens and create a token for the product family. See create a token.
2

Store it as a secret

In GitHub, open the repository’s Settings → Secrets and variables → Actions and add a repository secret named PHARUS_TOKEN with the token as its value.

The workflow

Save this as .github/workflows/pharus-sbom.yml:
What it does:
  • Trigger: every published release, and by hand from the Actions tab (workflow_dispatch).
  • Generate: anchore/sbom-action runs Syft on the checked-out repository and writes sbom.cdx.json.
  • Version: the release tag becomes the product version in Pharus. A run started by hand uses the branch or tag name.
  • Send: the step gzips the file and posts it to POST /api/v1/sboms. The X-Pharus-* headers fill in the Pipeline card on the SBOM’s page, with a link back to the run.
  • Fail loudly: --fail-with-body fails the step on any error and prints Pharus’ message in the log.

Variations

Set format: spdx-json and output-file: sbom.spdx.json on anchore/sbom-action, and gzip sbom.spdx.json in the last step. Pharus reads SPDX JSON 2.2 and 2.3.
Add image: with the image reference to anchore/sbom-action, for example image: ghcr.io/acme/gateway-g3:4.2, to describe the image instead of the source tree.
sbomify-action saves the SBOM it uploads as sbom_output.json. Add the Send SBOM to Pharus step after it, with gzip -c sbom_output.json and X-Pharus-Source: sbomify. The sbomify tab of Connect a pipeline has the step ready to copy.

Check that it worked

A successful run logs Pharus’ answer, for example:
In Pharus, the SBOM appears under SBOMs with GitHub Actions as its Source, and the token’s Last used time changes under Settings → API tokens. A re-run for the same release answers with "duplicate":true. If the step fails, the log shows the error code. The most common: All codes are listed under errors.

Upload an SBOM

API introduction

Azure Pipelines

GitLab CI