Providing Git Metadata
Control how Axe Watcher collects Git information for your test runs
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.
If this is the project's first successful session, the auto-detected repository becomes the project's locked repository. Later runs against a different repository are rejected. See Run Rejected: Data Shape or Repository Doesn't Match the Project.
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.
If the project is already locked to Git, disabling collection no longer produces a Gitless session: the run is rejected instead. Send Gitless runs to a separate, Gitless-locked project.
(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.
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. If the project has not yet locked to a data shape, a session submitted without all three is recorded as Gitless, and the project locks to Gitless going forward. Once a project is locked to Git, a session missing any of the three is rejected at ingestion instead: the results are not saved. See Run Rejected: Data Shape or Repository Doesn't Match the Project for the rejection message and how to resolve it. 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"));Run Rejected: Data Shape or Repository Doesn't Match the Project
Once a project has ingested its first successful session, its data shape (Git or Gitless) and, for Git projects, its repository, are locked. A run that doesn't match the lock is rejected at ingestion, and the results are not saved.
Common causes:
- A second repository or test suite is pointed at the same project. Send it to its own project instead of the one already locked to a different repository.
- A shallow clone, detached HEAD state, or a missing
originremote is stripping the repository URL, branch, or commit SHA, making a Git run look Gitless. See Axe Watcher in Continuous Integration (CI) Environments for CI-specific guidance. - Git data collection was disabled on a project already locked to Git. Sending a run with
git: falseno longer converts the project to Gitless; the run is rejected. Send Gitless runs to a separate, Gitless-locked project instead.
See Run Rejected in Troubleshooting for the exact rejection message.
See Also
- (JavaScript/TypeScript)
AxeConfiguration.git - (Java)
AxeWatcherOptions.setGitInfo() - (Java)
AxeWatcherGitInfo - Use Axe Watcher in Continuous Integration (CI) Environments
