Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Repository commands use the checkout’s `origin` by default. Use `--remote NAME

`proofline review --range BASE..HEAD --fail-on serious` exits 3 when a complete review has an unresolved finding at or above the threshold. PR reviews use the server’s effective open-item counts; other reviews count unresolved findings. Incomplete and unavailable results retain their nonzero exits. `--fail-on` cannot be combined with `--no-wait`.

In GitHub Actions, `proofline ci review --annotations` prints unresolved findings as workflow annotations at verified cited lines. Findings without a verified head location appear on the job. The review link contains the full result.
In GitHub Actions, `proofline ci review --annotations` prints unresolved findings as workflow annotations at verified cited lines. Findings without a verified head location appear on the job. Add `--summary` to append a Markdown job summary (assessment coverage, gaps, and escaped unresolved findings within GitHub's 1 MiB step summary limit) to `GITHUB_STEP_SUMMARY`, or `--summary FILE` to write it to a chosen path. The review link contains the full result.

For a CodePipeline execution or Amplify job, run `proofline ci deploy --commit SHA --aws-run ID` in a later pipeline. Add `--environment-id UUID` to select its Proofline environment. The output names the AWS provider and run ID. Proofline records successful CodePipeline executions and failed, stopped or cancelled ones it ties to the ECS rollout that served the commit. A reader inside a still-running execution finds no matching deploy, waits until its timeout and exits 2. On a GitHub `workflow_run` event, an explicit `--aws-run` disables the default Actions run and attempt filters.

Expand Down
56 changes: 51 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ mod sarif;
mod scan;
mod setup;
mod severity;
mod summary;
pub mod text;
mod tls;
pub mod update;
Expand Down Expand Up @@ -233,6 +234,10 @@ struct CiReviewArgs {
/// uploading `--sarif` to code scanning, this works on every GitHub plan.
#[arg(long)]
annotations: bool,
/// Also write the review as a Markdown job summary. Without a file path,
/// appends to `GITHUB_STEP_SUMMARY`; with a file path, writes that file.
#[arg(long, value_name = "FILE", num_args = 0..=1)]
summary: Option<Option<PathBuf>>,
/// Print JSON instead of text.
#[arg(long)]
json: bool,
Expand Down Expand Up @@ -634,10 +639,24 @@ pub async fn run(cli: Cli, token: Option<SecretString>) -> anyhow::Result<Verdic
}
Command::Ci(CiCommand::Review(args)) => {
let commit = ci_commit(args.commit.as_deref())?;
let summary_target = summary::resolve_target(
args.summary.as_ref().map(|path| path.as_deref()),
std::env::var_os(summary::GITHUB_STEP_SUMMARY_ENV),
)?;
let http = Http::new(origin)?;
let event = std::env::var(github_actions::EVENT_NAME).unwrap_or_default();
let issuer = github_actions::Issuer::from_environment();
let result = ci_job(http, token, issuer, &event, cli.org, &args, &commit).await;
let result = ci_job(
http,
token,
issuer,
&event,
cli.org,
&args,
&commit,
summary_target.as_ref(),
)
.await;
ci_ending(result)
}
Command::Ci(CiCommand::Deploy(mut args)) => {
Expand Down Expand Up @@ -1529,6 +1548,7 @@ async fn ci_job(
org: Option<Uuid>,
args: &CiReviewArgs,
commit: &str,
summary_target: Option<&summary::SummaryTarget>,
) -> anyhow::Result<Verdict> {
let (api, request) = match (token, issuer) {
(None, Some(issuer)) => {
Expand All @@ -1539,7 +1559,7 @@ async fn ci_job(
}
(token, _) => (connect(http, token, org).await?, None),
};
ci_review(&api, args, commit, request.as_ref()).await
ci_review(&api, args, commit, request.as_ref(), summary_target).await
}

/// How long a pull-request job waits for the App's review of its head before
Expand Down Expand Up @@ -1602,6 +1622,7 @@ async fn ci_review(
args: &CiReviewArgs,
commit: &str,
request: Option<&github_actions::ReviewRequest>,
summary_target: Option<&summary::SummaryTarget>,
) -> anyhow::Result<Verdict> {
let started = tokio::time::Instant::now();
let deadline = poll_deadline(args.timeout)?;
Expand All @@ -1628,9 +1649,23 @@ async fn ci_review(
return Ok(Verdict::Unavailable);
};
confirm_ci_subject(&detail, commit, repository_id)?;
let verdict = ci_verdict(state, detail.open_items.as_ref(), args.fail_on);
if let Some(path) = sarif_path {
write_sarif(api, review_id, &detail, path).await?;
}
if let Some(target) = summary_target {
let gate = match (state, verdict, args.fail_on) {
(Some(Outcome::Completed), Verdict::ThresholdReached, Some(threshold)) => {
summary::GateVerdict::ThresholdReached(threshold)
}
(Some(Outcome::Completed), Verdict::Unavailable, Some(threshold)) => {
summary::GateVerdict::Unmeasured(threshold)
}
(Some(Outcome::Completed), Verdict::Done, Some(_)) => summary::GateVerdict::Passed,
_ => summary::GateVerdict::None,
};
summary::write_summary(target, &detail, state, gate, &api.review_url(review_id)).await?;
}
if args.annotations {
annotations::write(&detail, &mut std::io::stderr().lock())?;
}
Expand All @@ -1642,7 +1677,6 @@ async fn ci_review(
state,
OutputFormat::from_json(args.json),
)?;
let verdict = ci_verdict(state, detail.open_items.as_ref(), args.fail_on);
say_ci_ending(api, review_id, &detail, state, verdict, args.timeout);
Ok(verdict)
}
Expand Down Expand Up @@ -2164,6 +2198,7 @@ mod tests {
commit: None,
sarif: None,
annotations: false,
summary: None,
json: false,
timeout: 3,
fail_on: None,
Expand All @@ -2175,7 +2210,7 @@ mod tests {
};
let token = stored_token.then(|| SecretString::from("plp_stored"));
let org = stored_token.then(|| ORG.parse().unwrap());
let ended = ci_job(http, token, Some(issuer), event, org, &args, HEAD)
let ended = ci_job(http, token, Some(issuer), event, org, &args, HEAD, None)
.await
.unwrap();
assert_eq!(ended, verdict, "{case}");
Expand Down Expand Up @@ -2236,6 +2271,7 @@ mod tests {
commit: None,
sarif: None,
annotations: false,
summary: None,
json: false,
timeout: 3,
fail_on: None,
Expand All @@ -2245,7 +2281,17 @@ mod tests {
remote: "origin".to_owned(),
},
};
let verdict = ci_job(http, None, Some(issuer), "pull_request", None, &args, HEAD).await;
let verdict = ci_job(
http,
None,
Some(issuer),
"pull_request",
None,
&args,
HEAD,
None,
)
.await;
ticker.abort();
let received = received.lock().unwrap().clone();
(verdict, received)
Expand Down
Loading