Skip to content

Commit dde5524

Browse files
Add CLA Assistant retry workflow
1 parent cb92b6f commit dde5524

5 files changed

Lines changed: 407 additions & 1 deletion

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Retry CLA Assistant
2+
3+
# CLA Assistant publishes `license/cla` as a commit status, not a check run.
4+
# If its webhook handler misses a PR update, GitHub branch protection can wait
5+
# forever even after every real CI check has passed. This workflow nudges CLA
6+
# Assistant only when that status is the sole remaining non-green signal.
7+
#
8+
# SECURITY: This workflow uses pull_request_target so it can inspect PR status
9+
# for forks, but it must never check out, build, or execute code from the PR.
10+
11+
on:
12+
pull_request_target:
13+
types: [opened, reopened, synchronize, ready_for_review]
14+
workflow_run:
15+
workflows:
16+
- CI
17+
- Internal Tests
18+
- CodeQL
19+
- Check merge labels
20+
- Review Checks
21+
types: [completed]
22+
workflow_dispatch:
23+
inputs:
24+
pr_number:
25+
description: "Pull request number to check"
26+
required: true
27+
type: number
28+
29+
permissions:
30+
actions: read
31+
checks: read
32+
contents: read
33+
pull-requests: read
34+
statuses: read
35+
36+
concurrency:
37+
group: retry-cla-assistant-${{ github.event.pull_request.number || github.event.inputs.pr_number || github.run_id }}
38+
cancel-in-progress: false
39+
40+
jobs:
41+
retry-cla:
42+
name: Retry CLA Assistant if it is the only blocker
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- name: Check out trusted base code
47+
uses: actions/checkout@v4
48+
with:
49+
ref: ${{ github.event.repository.default_branch }}
50+
51+
- uses: dsherret/rust-toolchain-file@v1
52+
53+
- uses: Swatinem/rust-cache@v2
54+
with:
55+
cache-all-crates: true
56+
57+
- name: Recheck CLA Assistant
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
INPUT_PR_NUMBER: ${{ inputs.pr_number }}
61+
run: cargo ci retry-cla-assistant

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/ci/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ anyhow.workspace = true
99
chrono = { workspace = true, features=["clock"] }
1010
clap.workspace = true
1111
regex.workspace = true
12-
reqwest = { workspace = true, features = ["blocking"] }
12+
reqwest = { workspace = true, features = ["blocking", "json"] }
13+
serde.workspace = true
1314
serde_json.workspace = true
1415
duct.workspace = true
1516
tempfile.workspace = true

tools/ci/src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const README_PATH: &str = "tools/ci/README.md";
1414

1515
mod ci_docs;
1616
mod keynote_bench;
17+
mod retry_cla_assistant;
1718
mod smoketest;
1819
mod util;
1920

@@ -367,6 +368,8 @@ enum CiCmd {
367368
VersionUpgradeCheck,
368369
/// Builds the docs site.
369370
Docs,
371+
/// Retries CLA Assistant if `license/cla` is the only remaining PR blocker.
372+
RetryClaAssistant(retry_cla_assistant::RetryClaAssistantArgs),
370373
}
371374

372375
fn run_all_clap_subcommands(skips: &[String]) -> Result<()> {
@@ -772,6 +775,10 @@ fn main() -> Result<()> {
772775
run_docs_build()?;
773776
}
774777

778+
Some(CiCmd::RetryClaAssistant(args)) => {
779+
retry_cla_assistant::run(args)?;
780+
}
781+
775782
None => run_all_clap_subcommands(&cli.skip)?,
776783
}
777784

0 commit comments

Comments
 (0)