Labs · Preview: @putnami/observe. Public and usable, but may change before becoming stable. What each status means
What putnami observe reads
putnami observe is the default subcommand of the observe group. It is
interactive and workspace-optional, so it runs from the user scope in any
directory. Inside a Putnami workspace only the workspace's own extensions
answer, so the workspace must declare @putnami/observe to run it there.
Flags
| Flag | Meaning |
|---|---|
--base <commit or branch> |
The commit the change is measured against. It overrides the CI. A CI other than GitHub Actions or GitLab CI needs it; outside a CI it defaults to the remote default branch. |
--head <revision> |
The commit that was built. Default HEAD. |
--junit <paths> |
Comma-separated JUnit XML or TRX paths, .xcresult bundles, or glob patterns, resolved against the directory you run in. Replaces JUnit discovery. |
--coverage <paths> |
The same for coverage reports and .xcresult bundles. Replaces coverage discovery. |
--sbom <path> |
The software bill of materials (SBOM) of the commit, a path or glob pattern. Replaces SBOM discovery. |
--base-sbom <path> |
The SBOM of the base. Without it, the base state of each dependency is unknown. |
--architecture <paths> |
The deptrac --formatter=junit report and the lint-imports output, comma-separated paths or glob patterns. Replaces their discovery. See Architecture rules. |
--archunit-classes <patterns> |
Class name patterns, such as *ArchitectureTest, whose JUnit cases are ArchUnit rules, besides the test classes that import com.tngtech.archunit. |
--moon-graph <path> |
The moon project graph export, from moon project-graph --json. Default moon-graph.json at the repository root when it exists. See the moon detector. |
--pants-graph <path> |
The Pants export pants peek :: wrote, resolved against the directory you run in. Default pants-graph.json at the repository root. See the Pants detector. |
--bazel-graph <path> |
The Bazel query export, from bazel query 'deps(//...)' --output=streamed_jsonproto. Default bazel-graph.json at the repository root. See the Bazel detector. |
--decisions <directories> |
Comma-separated directories that hold MADR decision records, relative to the repository root; an entry outside the repository is a diagnostic and is not read. Default docs/decisions and docs/adr. See Decision records. |
--no-fetch |
Read only the local history: fetch no base and deepen no shallow clone. |
--evidence <path> |
Write the change evidence document to this path, resolved against the directory you run in. |
--upload |
Hand the change evidence document to the evidence reporter. See Uploading the evidence. |
--open |
Upload as --upload does, letting the reporter sign you in first, and open the report in the browser outside a CI. See Opening the report. |
--details |
Print the detailed summary instead of the short one. See Output. |
--history [<duration>] |
Observe the recent history of the default branch instead of one change. See The recent history. |
--publish |
Post a commit status and one summary note that link to the report on the pull or merge request. Needs --upload. See Publishing on the pull or merge request. |
--from-evidence <path> |
Relay the evidence document another run kept instead of observing, in a GitHub Actions workflow_run job: --upload and --publish then use this job's credentials. Takes no other flag but --upload and --publish. See Pull requests from a fork. |
A glob pattern takes *, ?, [...] and **, which matches any number of
directories.
The CI
| CI | Recognized by | Repository key | Change request |
|---|---|---|---|
| GitHub Actions | GITHUB_ACTIONS=true |
GITHUB_SERVER_URL host, GITHUB_REPOSITORY_ID |
GITHUB_REF refs/pull/<n>/merge, or the event payload |
| GitLab CI | GITLAB_CI=true |
CI_SERVER_HOST, CI_PROJECT_ID |
CI_MERGE_REQUEST_IID |
| Jenkins | JENKINS_URL |
the origin remote, with --upload or --open |
none |
| CircleCI | CIRCLECI=true |
the origin remote, with --upload or --open |
none |
| Buildkite | BUILDKITE=true |
the origin remote, with --upload or --open |
none |
| Azure Pipelines | TF_BUILD=true |
the origin remote, with --upload or --open |
none |
| Bitbucket Pipelines | BITBUCKET_BUILD_NUMBER |
the origin remote, with --upload or --open |
none |
| TeamCity | TEAMCITY_VERSION |
the origin remote, with --upload or --open |
none |
| Any other | CI=true or none of the above |
the origin remote, with --upload or --open |
none |
The first marker that matches names the CI, in the order of this table, and
ci.system carries its name (jenkins, circleci, buildkite,
azure-pipelines, bitbucket-pipelines, teamcity); any other CI is
generic. Values compare without case, and a variable without a value in the
table matches any non-empty value. The evidence protocol owns this table.
Only GitHub Actions and GitLab CI fill the code host, the project id, the
branch, the change request and the run ids from their own variables. In
another CI, a run with --upload or --open reads the repository from the
origin remote as a laptop run does, below, and asks the code host API for its
numeric project id; the CI system stays as detected. Without --upload or
--open, the document of another CI names no numeric project id, and
@putnami/cloud refuses to upload a document without one. A Bitbucket
Pipelines checkout has its origin on bitbucket.org, so its repository has
no key.
The repository path (GITHUB_REPOSITORY, CI_PROJECT_PATH, or the path of
the origin remote) is for display only. A GitHub or GitLab job without a
numeric project id gets the observe.project_id_missing diagnostic.
The commit is the one the job checked out and measured, HEAD or --head. On
a GitHub pull request that is the merge commit refs/pull/<n>/merge, not the
pull request's head, so the changed files are the pull request's own changes.
Outside a CI, on a laptop, and in another CI with --upload or --open, the
repository is read from the origin remote. On
github.com, gitlab.com or a host whose name starts with gitlab., and only
with --upload or --open, observe asks the code host API for the numeric
project id (GitHub
GET /repos/{owner}/{repo}, GitLab GET /projects/{path}), with
GITHUB_TOKEN or PUTNAMI_GITLAB_TOKEN when one is set, so the key is the one
a CI job of the same repository sends. A remote on another host, or one the API
does not answer, such as a private repository without a token, keeps the
provider generic and gets observe.project_id_missing, which names the token
to set. The branch is the current one, none on a detached checkout.
GitHub Actions exposes no numeric job id, so the run's job is the job key
GITHUB_JOB, which every leg of a matrix shares.
The base
The base is the first of:
--base.- The merge request's diff base,
CI_MERGE_REQUEST_DIFF_BASE_SHA. - The pull request's base commit from the event payload, else its target
branch,
GITHUB_BASE_REF, read onorigin. - The previous commit of a push: the event payload's
beforeon GitHub,CI_COMMIT_BEFORE_SHAon GitLab, unless it is all zeros. - Outside a CI, the default branch of the
originremote, whichrefs/remotes/origin/HEADrecords:putnami observeon a laptop needs no flag. A clone without it getsobserve.base_missing;git remote set-head origin --autorecords it.
A base missing from the local history is fetched from origin. On a shallow
clone (fetch-depth: 1 on GitHub, GIT_DEPTH on GitLab), the history is then
deepened by 64 commits, then 128, and so on for ten steps, until the merge base
of the base and the head is reachable. The changed files are the diff from that
merge base to the head, each added, modified, deleted or renamed.
When no base is named, none can be fetched, or the histories share no commit,
the changed files are empty and a diagnostic says why:
observe.base_missing, observe.base_unresolved or
observe.merge_base_unreachable.
What it writes
In the directory you run it in, putnami observe writes only the Git history
it fetches to reach the merge base (objects, the origin branch of the base
and the shallow boundary) and the file --evidence names. When the server
refuses to deepen by commit id, the history is deepened through the remote's
configured refspecs, which also updates their remote-tracking branches. The
working tree, the index and HEAD stay as they were. Its fetches start no
automatic Git maintenance, so nothing repacks the history after it exits.
--no-fetch turns the fetch off. Everything else is printed.
The fetch and the deepening need Git 2.29 or later. With an older Git, each fails as a diagnostic.
Reports
Without --junit or --coverage, putnami observe walks the repository,
skipping .git, node_modules, vendor, the Gradle and Maven build
outputs that hold no report (see Gradle and Maven), and
all of a Cargo target directory but its nextest store, its nested target
directories and the files it holds directly (see
the Cargo detector), and reads the start of each file
whose name can hold a report (.xml, .trx, .info, .lcov, .out, .cov,
.coverprofile, .gocov, and .txt files whose name contains cover). It
keeps a file by its content:
| Format | Recognized by |
|---|---|
| JUnit XML | a testsuites or testsuite root (Jest, Vitest, PHPUnit --log-junit, gotestsum, pytest --junitxml, bazel test, Gradle, Maven Surefire and Failsafe, cargo-nextest) |
| Cobertura | a coverage root with line-rate, lines-valid or branch-rate, or a sources or packages child (pytest-cov --cov-report=xml, Coverlet --collect:"XPlat Code Coverage", cargo-llvm-cov --cobertura) |
| Clover | a coverage root with generated or clover, or a project child (PHPUnit --coverage-clover) |
| JaCoCo | a report root whose first child is sessioninfo, group, package or counter (the JaCoCo Maven plugin, the Gradle jacoco plugin, Kover) |
| LCOV | a first TN: or SF: record (bazel coverage --combined_report=lcov, cargo-llvm-cov --lcov) |
| Go cover profile | a first mode: set, mode: count or mode: atomic line |
| TRX | a TestRun root (dotnet test --logger trx), read as test cases |
.xcresult bundle |
a *.xcresult directory that holds an Info.plist, which the walk does not enter, read as test cases and coverage through xcrun; when the walk also finds a JUnit report anywhere in the repository, only as coverage (see iOS and Swift) |
The walk does not follow links. It also reads, through the links Bazel leaves
at the root, the test.xml of each test target, shard and run under
bazel-testlogs and the combined LCOV
report bazel-out/_coverage/_coverage_report.dat; see
the Bazel detector.
Without --sbom, it also reads the .json files whose name contains bom,
cdx, cyclonedx or spdx, and keeps a CycloneDX document (a
"bomFormat": "CycloneDX" member) or an SPDX one (a "spdxVersion": "SPDX-…"
member) as the commit's SBOM. A missing SBOM is no diagnostic. The base SBOM
is never discovered: name it with --base-sbom, and discovery then leaves
that file out. When a side has several SBOMs, none is read, with
observe.sbom_ambiguous: a repository that commits SBOM documents, such as
test fixtures, names its own with --sbom. See
licences and vulnerabilities.
Discovery stops after 200 000 entries or 10 000 candidate files, and keeps at
most 1 000 reports, with the observe.discovery_bounded diagnostic. A named
glob pattern has the same bounds and the same diagnostic. A kind
with no report gets observe.report_missing. A named path that matches
nothing gets observe.report_missing, an unreadable file
observe.report_unreadable, and a file of another kind or none
observe.report_unrecognized.
Output
The summary is short: the CI, the repository, the commit, the base, the count
of changed files, the changed and dependent components (the first 10), the
coverage of the changed lines, and the count of dependency changes with the
count of licence changes, of vulnerabilities introduced and fixed and of
changes whose base or head state no SBOM lists, then the warnings, the errors
and the --publish diagnostics. Its last line names the next command:
| Situation | Last line |
|---|---|
| An upload answered a report URL | Full report: <url> |
| Outside a CI | putnami observe --open |
A run of Putnami/observe-action without its token input |
The token input and putnami cloud token create --organization <id> --name ci, which creates it |
Another GitHub Actions job whose reporter is @putnami/cloud, without PUTNAMI_CLOUD_TOKEN or PUTNAMI_ORGANIZATION |
The ID token exchange (PUTNAMI_ORGANIZATION and permissions: id-token: write), or the PUTNAMI_CLOUD_TOKEN setting and putnami cloud token create --organization <id> --name ci, which creates it |
A run of the GitLab component on gitlab.com without its organization input or PUTNAMI_CLOUD_TOKEN |
The organization input, or the PUTNAMI_CLOUD_TOKEN setting and putnami cloud token create --organization <id> --name ci, which creates it |
A run of the GitLab component on another GitLab instance, without PUTNAMI_CLOUD_TOKEN |
The PUTNAMI_CLOUD_TOKEN setting and putnami cloud token create --organization <id> --name ci, which creates it |
Another GitLab CI job of gitlab.com whose reporter is @putnami/cloud, without PUTNAMI_CLOUD_TOKEN or PUTNAMI_ORGANIZATION |
The ID token exchange (PUTNAMI_ORGANIZATION and an id_tokens entry PUTNAMI_ID_TOKEN), or the PUTNAMI_CLOUD_TOKEN setting and putnami cloud token create --organization <id> --name ci, which creates it |
Another CI job whose reporter is @putnami/cloud, without PUTNAMI_CLOUD_TOKEN |
The PUTNAMI_CLOUD_TOKEN setting and putnami cloud token create --organization <id> --name ci, which creates it |
| Any other CI job | --upload |
--details prints the detailed summary instead: the changed files (the first
50), the changed and dependent components, the tests and coverage of each
component, the changed-line coverage with its least covered files, the
dependency changes with their licences and vulnerabilities, the decisions, the
reports and the specs, then each diagnostic. See
the change analyses. putnami observe
exits 0 whatever it observes, 2 on a usage error, and 1 when it cannot read its
job context or write its output. --output=json
prints one document with subject, ci, producer, base,
deepenedCommits, changedFiles, reports, analysis, specs and
diagnostics.
Specs
putnami observe reads the specs a repository keeps, in the formats the
features protocol reads, with the same readers a workspace uses:
| Format | Where it looks |
|---|---|
| GitHub Spec Kit | specs/<feature>/spec.md, at any depth |
| OpenSpec | openspec/specs/<capability>/spec.md; a change in flight under openspec/changes is not a current spec |
| Kiro | .kiro/specs/<feature>/requirements.md |
| Gherkin | each .feature file |
It walks the repository as report discovery does, skipping .git,
node_modules and vendor. Each spec in the specs member of the JSON
document has its format, its path, the file that holds its requirements,
the component that owns it, whether the change touches it (changed), and
its requirements, each with its id, its text and its line. A spec its
reader refuses gets observe.spec_unreadable, a warning, and the others are
still reported. The summary lists each spec with its requirement count.
The evidence document
--evidence <path> writes a
protocol/evidence v1 document: the
subject, the CI run, the producer, the changed files with their component,
the components with their impact and edges, the tests and coverage per
component, the changed-line coverage, the dependency changes with their
before and after states, the sbom they come from, the decisions the
change concerns, and the diagnostics.
The document is validated before it is written, and replaces the file in one
rename. A document that does not validate, such as one without a commit or a
GitHub or GitLab job without its numeric project id, is written nowhere and
gets observe.evidence_invalid; a path that cannot be written gets
observe.evidence_unwritable. Diagnostics past the document's 500 are
summarized by observe.too_many_diagnostics. A run page that is not an https
URL without credentials is left out with observe.run_url_dropped, and the
rest of the document is written.
Uploading the evidence
--upload hands the evidence document to the evidence reporter. Without
--evidence, the document goes to a temporary file that is removed after the
upload.
The reporter is an installed extension. PUTNAMI_EVIDENCE_REPORTER names it,
@putnami/cloud when unset. Observe runs
putnami <name> evidence-report --file <path> --output=json, where <name> is
the extension name without its scope, through the CLI that started it, with
PUTNAMI_NO_AUTO_INSTALL=1. The reporter's standard error goes to standard
error. A third party writes its own reporter as one workspace-optional
subcommand evidence-report that takes --file and --output.
The reporter answers on standard output with one protocol CLI version 2
result. When it stored the evidence, data.reportUrl is the URL of the report:
{"protocolVersion": 2, "command": "cloud evidence-report", "status": "success", "exitCode": 0,
"data": {"reportUrl": "https://putnami.app/w/acme/changes/42"}}Observe prints that URL on standard error, and --publish links it. It keeps
the URL only when it is an absolute https URL without credentials, at most
2048 bytes, with no whitespace, quote, backtick, backslash, angle bracket or
parenthesis. A reporter that answers no
result or no such URL still uploaded: observe keeps no URL and gives no
diagnostic. When the reporter writes several results, the last one counts.
Standard output that holds no result goes to standard error. A reporter must
accept --output=json: one that refuses the flag fails every upload.
A reporter may also answer data.level3Preview: what level 3 would have held
on the change, signal by signal. Putnami Cloud computes it on the run the
upload opened.
"level3Preview": {"level": 3, "baseBranch": "main",
"brokenRules": {"state": "known", "count": 1},
"vanishedTests": {"state": "unknown", "reason": "no-base-test-cases"}}The signals are brokenRules, coverageLost, deletedDecisions,
untestedSpecs and vanishedTests. A signal is known, with its count, only
when its state is known and its count is a non-negative integer. Any other
signal, a missing one included, is unknown, with the reason the reporter
gave or one observe writes: observe never reads it as zero. A known signal
whose notCompared lists components is partly compared: its count holds for
the other components only. Putnami Cloud lists at most 50 components a signal
did not compare, so a list of 50 may have been cut, and the note then says at
least 50. A level3Preview that is not an object is dropped
without a diagnostic, and the upload still succeeded. Observe keeps the
preview for --publish.
The upload never fails the job. A reporter that cannot start, exits non-zero
or runs past 2 minutes, a selector that is not an extension name, and a
document that was not written each give observe.upload_failed, and observe
still exits 0. When the reporter exits non-zero with a failure result, the
diagnostic ends with the result's error message.
For @putnami/cloud, the job sets PUTNAMI_CLOUD_TOKEN to its organization's
ingest token, which putnami cloud token create --organization <id> --name ci
creates and prints once, signed in, with no Putnami workspace. A GitHub
Actions job, or a gitlab.com CI job whose id_tokens declares
PUTNAMI_ID_TOKEN, can instead set PUTNAMI_ORGANIZATION and exchange its ID
token.
See
the Cloud extension.
Opening the report
--open is --upload for a person. Outside a CI, observe adds --sign-in to
the reporter's command; in a CI it does not, so a job without a token fails
its upload at once instead of waiting for a sign-in: with no token and no stored session, @putnami/cloud runs the device
sign-in of putnami cloud login, which opens the browser and waits for you,
and the next runs reuse that session. The reporter then has 16 minutes instead
of 2. Observe prints the report URL the reporter answers, ends the summary with
it and, outside a CI, opens it in the browser. Without --open or --upload,
observe runs no reporter and calls no code host API: nothing leaves the
machine.
The recent history
A CI deletes its logs and artifacts after a retention period, 90 days by
default on GitHub Actions, so a repository set aside has no CI report left.
putnami observe --history analyzes its recent past on your laptop instead:
putnami observe --history # the last 14 days
putnami observe --history 30d --openIt reads the first-parent commits of the origin remote's default branch,
refs/remotes/origin/HEAD, whose commit date falls in the window: 14 days by
default, or the <n>h, <n>d or <n>w you give it, at most 365d. The
window ends now, or at the branch's last commit when the branch had no commit
since the window began, so an idle repository shows its last 14 days of
activity. A clone that records no default branch reads the current branch
instead and warns with observe.history_default_branch_missing; git remote set-head origin --auto records it. Fetch first to read the latest history:
--history reads the local clone only.
It observes at most 100 commits, sampled evenly over the window and observed
newest first. Each commit is checked out, detached, in a temporary worktree
that runs no hook of the repository, fetches no Git LFS file and checks out
no submodule, and is measured against its first parent: the components, the dependency changes,
the decisions, the declarations and the specs, without test, coverage, SBOM
or architecture reports, which a commit's checkout does not hold. A root
commit, or one on the edge of a shallow clone, has no parent and is skipped.
The run spends at most 10 minutes, not counting the wait for a sign-in; the
oldest commits left after that are skipped with the
observe.history_budget_spent warning, which counts them. An interrupt stops
the run with observe.history_interrupted and keeps what was already
observed and uploaded.
Each commit gives one evidence document whose run id is
history-<commit SHA>. --evidence <directory> writes them to
<directory>/<commit SHA>.json. --upload and --open hand each to the
evidence reporter as soon as the commit is observed: --open signs you in
once and opens the report of the newest commit. The reporter derives the
submission id from the run id, so a second run uploads the same commits again
and Putnami Cloud keeps one run per commit; @putnami/cloud also puts in the
submission id whether it ran on a laptop or in a CI, so the same commit
uploaded from both is kept twice. The first failed upload stops the others
and says how many were left. --history takes none of the flags that name a
base, a head, a report or an export of one commit, nor --publish,
--details or --fetch.
The summary names the repository, the branch and the window, then one line
per commit: its date, its changed files, its changed components and its
dependency changes. With --output=json it prints one document with the
window and each commit's observation. The worktree is removed when the run
ends; your working tree, index and HEAD stay as they were.
Publishing on the pull or merge request
--publish posts the summary where a reviewer reads it, with a token the CI
already has, and links it to the full report. It needs --upload: the note
is where a reviewer meets the report, so it links the report the upload
stored, the URL the reporter answered. Without --upload, --publish posts
nothing and logs observe.publish_needs_upload. When the upload fails, it
posts nothing and observe.publish_skipped says so.
putnami observe --upload --publishOn a GitHub pull request or a GitLab merge request it:
Sets the commit status
putnami/observeto success. On GitHub it goes on the head commit of the pull request, since the job built a merge commit. On GitLab it goes on the commit the pipeline ran for,CI_COMMIT_SHA, and joins that pipeline, so a merged results pipeline starts no other one. The status means the analysis ran, not that the tests passed. Its description counts the changed and dependent components, the coverage of the changed lines and the dependency changes, for example1 changed, 2 dependent components; changed lines 80.0% covered; 1 dependency change, or says that the base was not resolved. With a level 3 preview it ends with what level 3 would have held, for example; level 3 would have held it on 2 signals, 1 unknown, 1 partly compared, when that fits in the status's 140 characters, else in fewer words,; level 3 preview: 2 held, 1 unknown, 1 partial, when those fit. It counts apart the signals that would have held the change, the unknown ones and the partly compared ones that hold nothing; a partly compared signal that holds the change counts as held. It links the report (itstarget_url), or the CI run when the reporter answered no URL.Writes one Markdown note on the request. Its first link opens the report; without a report URL it links the CI run alone. With a level 3 preview, one line under the summary says what level 3 would have held on the change, names each unknown signal with its reason and each partly compared one with the number of components it did not compare, says "as far as the evidence tells" when one is either, or that the evidence does not tell when every signal is unknown, never "nothing", and names the next step to reach level 3:
Level 3 preview against
main: as far as the evidence tells, level 3 would have held this change on 1 broken rule; unknown: vanished tests (no-base-test-cases). Next step to level 3: make vanished tests known; the report shows how.The preview informs and never blocks: the status stays success whatever it holds. It lists the components with their tests and coverage, the failing tests, the least covered changed files, the dependency changes and the diagnostic codes. The note starts with the hidden line
<!-- putnami-observe:summary -->. The next run finds the first note that starts with that line and updates it, so the request keeps one note.
| Code host | Token | API |
|---|---|---|
| GitHub | GITHUB_TOKEN, with statuses: write and pull-requests: write |
GITHUB_API_URL, https://api.github.com when unset |
| GitLab | PUTNAMI_GITLAB_TOKEN: a project access token with the api scope and the Developer role |
CI_API_V4_URL, else CI_SERVER_URL followed by /api/v4 |
The GitLab job token cannot write notes, so GitLab needs a project access
token stored as a masked CI/CD variable. A self-managed GitLab answers on its
own URL, which GitLab CI sets in CI_API_V4_URL.
The token goes only to an https API URL without credentials, and observe
follows no redirect. Run --publish in one job of the pipeline: two jobs that
publish on the same request overwrite each other's note.
Publishing never fails the job:
| Case | Diagnostic |
|---|---|
--publish without --upload |
observe.publish_needs_upload (info) |
| The upload failed | observe.publish_skipped (info) |
| A CI other than GitHub Actions or GitLab CI, or a job that runs for no pull or merge request, such as a branch push | observe.publish_skipped (info) |
| The code host's token is unset | observe.publish_token_missing (warning) |
| A refused or failed call, no GitLab API URL, an API URL that is not https, no commit to set the status on, or a run past 1 minute | observe.publish_failed (warning) |
A pull request from a fork gets a read-only GITHUB_TOKEN, so GitHub refuses
both calls with observe.publish_failed: relay its evidence from the base
repository, as the next section says. A failed status call does not stop
the note.
Pull requests from a fork
GitHub runs the workflow of a pull request from a fork with no ID token and a
read-only GITHUB_TOKEN, so that run can neither upload nor publish. It keeps
its evidence document as an artifact instead, and a second workflow of the
base repository, which workflow_run starts when the first one completes,
relays it:
putnami observe --from-evidence observe-evidence.json --upload --publish--from-evidence observes nothing: it runs no Git command and reads no
report, so the job needs no checkout. It reads the document, at most 64 MiB,
and checks it against the job:
- The job runs in GitHub Actions for a
workflow_runevent of apull_requestrun, withGITHUB_TOKEN, which reads the pull request and the commits. The repository, its numeric id and its host come from the job'sGITHUB_REPOSITORY,GITHUB_REPOSITORY_IDandGITHUB_SERVER_URL; the run, its page, its head commit and its head branch from theworkflow_runof the event payload. - The pull request is the one
workflow_run.pull_requestsnames at the run's head commit. GitHub lists none for a fork, so observe then asks the GitHub API, withGITHUB_TOKEN, for the open pull request of the job's repository whose head is the run's head owner, branch and commit. - The document's commit is the run's head commit, with a base the GitHub API answers as an ancestor of it, or the test merge commit GitHub keeps for the pull request, whose parents are the document's base and the run's head. A pull request merge commit GitHub has rebuilt since the run, after its base moved, no longer matches: run the pull request workflow again.
- A document that does not validate, or that names another code host, host, repository, repository id, pull request, commit or base than the job's, or another CI than GitHub Actions, is refused: nothing is uploaded or published. So is a fork's run whose pull request is not found.
The relayed document keeps the fork's checked commit and base and its analyses, and takes its repository, pull request and run from the job; it names no branch of a fork. The commit status goes on the pull request's head commit and the note on that pull request, both linking the fork's run. The document is the fork's claim, so the note quotes each of its texts as a code span, which renders no link, mention, image or HTML, and the job log prints counts and observe's own diagnostics, never a text of the document, so no line of it becomes a workflow command. Never check out or run the fork's code in that job: it holds the base repository's credentials.
| Case | Diagnostic |
|---|---|
Not a workflow_run job of a pull_request run, no GITHUB_TOKEN or repository id, a document that cannot be read, is over 64 MiB or does not validate, or that names another repository, pull request, commit or base, or a fork's run whose pull request is not found, such as after a new push or once it closed |
observe.evidence_refused (warning) |
| A run of the job's repository whose pull request is not found | observe.pull_request_unresolved (info): a document of the run's head commit is uploaded without a pull request and nothing is published; a document of a merge commit has no pull request to bind it, and is refused |
--from-evidence with an observation flag, --evidence, --open or
--details is a usage error. Observe a change in your CI
gives the two workflows, and the action's from-artifact input runs this
relay.
The note is the first one that starts with the hidden line, whoever wrote it. A comment that starts with that line is overwritten by the summary. When the token changes owner, for example a new GitLab project access token, the old note may refuse the update: delete it, and the next run creates a new one.