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. branch, commitSha, and url are the gitful fields: a session submitted without all three is recorded as gitless and saved, but Axe Developer Hub switches to the gitless session view, where branch and commit history from previous sessions will not be visible. Submitting a subsequent session with all three fields restores the gitful view. If only one or two of the three are present, Axe Watcher drops all gitful fields, records the session as gitless, and includes a warning in the response. The remaining fields are optional.

Field (JavaScript/TypeScript) Method (Java) Gitful Description
branch setBranch() yes Current branch name
commitAuthor setCommitAuthor() no Author display name. If omitted, the author appears as unavailable in Axe Developer Hub.
commitEmail setCommitEmail() no Author email address.
commitMessage setCommitMessage() no Full commit message. If omitted, the commit message appears as unavailable in Axe Developer Hub.
commitSha setCommitSha() yes Full or abbreviated commit hash
defaultBranch setDefaultBranch() no Default branch name (e.g. main). Without this field, Axe Developer Hub cannot identify which branch is the default, so feature-branch comparisons against the default branch will not be available.
isDirty setIsDirty() no true if there are uncommitted changes
tag setTag() no Current tag (e.g. v1.2.3)
url setUrl() yes Repository remote URL

(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,
    url: process.env.GIT_URL,
    commitAuthor: process.env.GIT_AUTHOR_NAME,
    commitEmail: process.env.GIT_AUTHOR_EMAIL,
    commitMessage: process.env.GIT_COMMIT_MESSAGE,
    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"))
        .setUrl(System.getenv("GIT_URL"))
        .setCommitAuthor(System.getenv("GIT_AUTHOR_NAME"))
        .setCommitEmail(System.getenv("GIT_AUTHOR_EMAIL"))
        .setCommitMessage(System.getenv("GIT_COMMIT_MESSAGE"))
        .setDefaultBranch("main"));

See Also