Skip to content

Commit 5a5a560

Browse files
Add CLA Assistant retry workflow
1 parent cb92b6f commit 5a5a560

5 files changed

Lines changed: 419 additions & 1 deletion

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
schedule:
15+
- cron: "7,22,37,52 * * * *"
16+
workflow_dispatch:
17+
inputs:
18+
pr_number:
19+
description: "Pull request number to check"
20+
required: true
21+
type: number
22+
23+
permissions:
24+
actions: read
25+
checks: read
26+
contents: read
27+
pull-requests: read
28+
statuses: read
29+
30+
concurrency:
31+
group: retry-cla-assistant-${{ github.event.pull_request.number || github.event.inputs.pr_number || github.run_id }}
32+
cancel-in-progress: false
33+
34+
jobs:
35+
retry-cla:
36+
name: Retry CLA Assistant if it is the only blocker
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- name: Check out trusted base code
41+
uses: actions/checkout@v4
42+
with:
43+
ref: ${{ github.event.repository.default_branch }}
44+
45+
- uses: dsherret/rust-toolchain-file@v1
46+
47+
- uses: Swatinem/rust-cache@v2
48+
with:
49+
cache-all-crates: true
50+
51+
- name: Recheck CLA Assistant
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
INPUT_PR_NUMBER: ${{ inputs.pr_number }}
55+
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)