Skip to content

ci: comment when stale-contributor.yml applies closing-soon#1290

Merged
thepagent merged 1 commit into
mainfrom
ci/stale-contributor-comment
Jul 4, 2026
Merged

ci: comment when stale-contributor.yml applies closing-soon#1290
thepagent merged 1 commit into
mainfrom
ci/stale-contributor-comment

Conversation

@chaodu-agent

Copy link
Copy Markdown
Collaborator

Summary

Found while investigating why PR #1272 had the closing-soon label despite
already having a valid Discord Discussion URL in its body. Turned out
pr-discussion-check.yml (the Discord URL check) wasn't the cause at all —
it ran once, matched the URL, and cleared the label correctly. The label
kept reappearing because of a separate, unrelated workflow:
stale-contributor.yml, which adds closing-soon to any PR that's held the
pending-contributor label for more than 2 days — with no explanation
posted to the author
, unlike pr-discussion-check.yml's Discord-URL check,
which always posts a [!CAUTION] comment.

That silence is the actual problem this PR fixes: an author (or anyone
investigating) sees closing-soon appear with zero context about which of
the several closing-soon-related workflows applied it or why, since there's
no comment to check.

Change

Add a caution comment to stale-contributor.yml, matching
pr-discussion-check.yml's existing alert style, whenever it adds
closing-soon:

> [!CAUTION]
> This PR has been waiting on the author for more than 2 days
> (labeled `pending-contributor` since <date>).
> It will be **automatically closed in 24 hours** if there is no update.

Please push a commit, respond to outstanding review feedback, or comment
here to keep this PR open. Feel free to reopen a new PR later if it gets
closed and you want to pick it back up.

Uses a <!-- openab-stale-contributor-check --> marker (checked against
existing comments) to avoid duplicate comments across runs — belt-and-suspenders
alongside the existing early-continue guard for PRs that already carry
closing-soon.

Scope

Only stale-contributor.yml (PRs) was changed, per the specific ask.
stale-issue.yml has the identical gap on the issue side but wasn't touched
here — happy to open a follow-up for it if wanted.

Testing done

  • Validated the workflow YAML parses correctly.
  • Not dry-run against a real stale PR (would require waiting 2 real days or
    manipulating label-event timestamps in a test repo) — the added logic
    mirrors pr-discussion-check.yml's already-working comment-posting pattern
    closely enough that I'm confident in the mechanics, but flagging this as
    the one part that's unverified against a live run.

Previously, when a PR's pending-contributor label aged past
STALE_DAYS (2), the workflow silently added closing-soon with no
explanation to the author — unlike pr-discussion-check.yml, which
always posts a [!CAUTION] comment explaining why the label was
applied and what happens next. Discovered while investigating why
PR #1272 had closing-soon despite already having a valid Discord
Discussion URL - turned out to be this workflow (a separate,
unrelated staleness check on pending-contributor), and the silence
made it non-obvious which of the several closing-soon-related
workflows was responsible.

Add a matching caution comment (same [!CAUTION] alert style as
pr-discussion-check.yml) when closing-soon is applied, stating how
long the PR has been pending-contributor and that it auto-closes in
24 hours per close-stale-prs.yml. Uses a marker comment to avoid
duplicate comments across runs (belt-and-suspenders alongside the
existing early-continue guard for PRs that already have the label).
@chaodu-agent chaodu-agent requested a review from thepagent as a code owner July 4, 2026 12:35
@chaodu-agent

Copy link
Copy Markdown
Collaborator Author

LGTM ✅ — Adds a clear caution comment to stale-contributor.yml so authors know why closing-soon appeared.

What This PR Does

When stale-contributor.yml adds the closing-soon label to a PR that has been pending-contributor for >2 days, it now posts an explanatory [!CAUTION] comment — matching the style already used by pr-discussion-check.yml. Previously, the label appeared with no context.

How It Works

After adding the closing-soon label, the workflow fetches existing comments and checks for an HTML marker (<!-- openab-stale-contributor-check -->). If no marker comment exists, it posts one explaining the situation and what the author should do.

Findings

# Severity Finding Location
1 🟢 Clean dedup pattern with HTML marker — mirrors the proven pr-discussion-check.yml approach .github/workflows/stale-contributor.yml:55
2 🟢 Message content is clear, actionable, and matches existing project tone .github/workflows/stale-contributor.yml:65-77
3 🟢 Minimal, focused change — only touches the file that needs it
Finding Details

🟢 F1: Clean dedup pattern

Uses the same <!-- marker --> + comments.some() approach proven in pr-discussion-check.yml. Belt-and-suspenders alongside the existing if (labels.includes(CLOSING)) continue guard.

🟢 F2: Clear message content

The caution block tells the author exactly what happened, when it happened (pending-contributor since date), and what to do — push a commit, respond to feedback, or comment.

🟢 F3: Focused scope

Only stale-contributor.yml is touched. The PR description transparently notes the same gap exists in stale-issue.yml and offers a follow-up.

Baseline Check
  • PR opened: 2025-07-04
  • Main already has: stale-contributor.yml that silently adds closing-soon; pr-discussion-check.yml that posts explanatory comments
  • Net-new value: Bridges the UX gap — stale-contributor.yml now explains itself like the other workflow does
What's Good (🟢)
  • Mirrors a proven pattern from pr-discussion-check.yml rather than inventing something new
  • HTML marker prevents duplicate comments across multiple hourly runs
  • PR description is thorough — clearly explains the investigation that led to the fix and acknowledges testing limitations honestly
  • Scope is intentionally minimal with a follow-up offered for stale-issue.yml
Robustness Note (not blocking)

If the createComment API call fails after the label is already added, subsequent hourly runs will skip the PR (because closing-soon is already present), so the explanatory comment would never be posted. In practice this is unlikely and the label itself still serves its purpose, but a future hardening pass could swap the order (comment first, then label) or remove the closing-soon early-exit for the comment-posting logic. Not blocking since the existing workflow has the same structural pattern.

@thepagent thepagent merged commit 7054f31 into main Jul 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants