Providing Git Metadata

This page is not available in the language you requested. You have been redirected to the English version of the page.
Link to this page copied to clipboard

Control how Axe Watcher collects Git information for your test runs

Not for use with personal data

Axe Watcher links accessibility results to the Git commit that was tested, allowing you to track issues across branches and builds in Axe Developer Hub. By default, Watcher collects this information automatically using the local Git binary. You can also disable collection entirely or supply the metadata yourself.

Automatic Collection (Default)

When no git configuration is provided, Watcher auto-detects the current branch, commit SHA, author, and other Git fields from the local repository. No additional configuration is required.

Disabling Git Collection

If your environment has no Git binary, or if you do not want Git data associated with a test run, you can disable collection entirely.

(JavaScript/TypeScript) Set the git property to false in your AxeConfiguration:

axe: {
  apiKey: process.env.AXE_DEVELOPER_HUB_API_KEY,
  projectId: process.env.AXE_DEVELOPER_HUB_PROJECT_ID,
  git: false
}

(Java) Call setGit(false) on your AxeWatcherOptions:

AxeWatcherOptions options = new AxeWatcherOptions()
    .setApiKey(System.getenv("AXE_DEVELOPER_HUB_API_KEY"))
    .setProjectId(System.getenv("AXE_DEVELOPER_HUB_PROJECT_ID"))
    .setGit(false);

Providing Explicit Metadata

Some CI setups run tests in a dedicated QA repository that is separate from the repository under test. In those cases, auto-detection would collect metadata from the QA repository rather than the code repository, producing misleading results in Axe Developer Hub. You need to supply the correct metadata explicitly.

Explicit metadata is also useful when auto-detection is unreliable, for example, in shallow clones or when the repository is in a detached HEAD state.

note

When explicit metadata is provided, auto-detection is skipped entirely for that test run. Any field you omit is transmitted as null.

The following fields are available. All fields are optional; supply only what is meaningful for your use case.

Field (JavaScript/TypeScript) Method (Java) Description
branch setBranch() Current branch name
tag setTag() Current tag (e.g. v1.2.3)
defaultBranch setDefaultBranch() Default branch (e.g. main)
commitSha setCommitSha() Full or abbreviated commit hash
commitAuthor setCommitAuthor() Author display name
commitEmail setCommitEmail() Author email address
commitMessage setCommitMessage() Full commit message
url setUrl() Repository remote URL
isDirty setIsDirty() true if there are uncommitted changes

(JavaScript/TypeScript) Pass a GitConfig object to the git property in your AxeConfiguration. The specific environment variable names depend on your CI platform:

axe: {
  apiKey: process.env.AXE_DEVELOPER_HUB_API_KEY,
  projectId: process.env.AXE_DEVELOPER_HUB_PROJECT_ID,
  git: {
    commitSha: process.env.GIT_COMMIT,
    branch: process.env.GIT_BRANCH,
    defaultBranch: 'main'
  }
}

(Java) Create an AxeWatcherGitInfo instance and pass it to setGitInfo() on your AxeWatcherOptions:

AxeWatcherOptions options = new AxeWatcherOptions()
    .setApiKey(System.getenv("AXE_DEVELOPER_HUB_API_KEY"))
    .setProjectId(System.getenv("AXE_DEVELOPER_HUB_PROJECT_ID"))
    .setGitInfo(new AxeWatcherGitInfo()
        .setCommitSha(System.getenv("GIT_COMMIT"))
        .setBranch(System.getenv("GIT_BRANCH"))
        .setDefaultBranch("main"));

See Also