The `github-build` library provides a minimalist interface for setting GitHub Commit Statuses (also known as "Checks" or "Build Statuses") via the GitHub API. It enables continuous integration (CI) services to report the status of builds, tests, and other automated checks directly on pull requests and commits within GitHub. The current stable version is `1.2.4`, primarily focused on stability and security. Its release cadence appears to be low, with releases often addressing specific issues like security patches. Key differentiators include its straightforward API for managing `pending`, `success`, `failure`, and `error` states, making it easy to integrate into CI pipelines without dealing directly with the complexities of the GitHub REST API for status updates. It's designed for simple, direct status reporting rather than comprehensive GitHub API interaction.
npm install github-buildVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `github-build` and use its methods (`start`, `pass`, `fail`, `error`) to update a GitHub commit status for a CI job, including secure token handling for sensitive credentials.
Upgrade to `github-build@1.2.4` or newer immediately to ensure the patched `axios` version is used and mitigate potential security risks.
Generate a GitHub token with the minimum required `repo:status` scope (for PATs) or ensure your GitHub App has 'Commit statuses' read and write permissions. Always verify the token's validity and expiration.
Always use `const Build = require('github-build')` to ensure correct module loading, especially in environments where ESM interoperability is not guaranteed or configured.Verify your `GITHUB_TOKEN` is correct and active. Ensure it has the `repo:status` scope or equivalent permissions for GitHub Apps. Re-generate if necessary.
Double-check the `repo` and `sha` values passed to the `Build` constructor. Confirm the repository exists and the commit SHA is valid and accessible.
Change your import statement to `const Build = require('github-build')` to correctly load the CommonJS constructor.