Skip to content

feat: automate stale and abandon PR detection and labeling#41

Open
pemamian wants to merge 11 commits into
Universal-Commerce-Protocol:mainfrom
pemamian:main
Open

feat: automate stale and abandon PR detection and labeling#41
pemamian wants to merge 11 commits into
Universal-Commerce-Protocol:mainfrom
pemamian:main

Conversation

@pemamian
Copy link
Copy Markdown

Description

Category (Required)

Please select one or more categories that apply to this change.

  • Core Protocol: Changes to the base communication layer, global context, or breaking refactors. (Requires Technical Council approval)
  • Governance/Contributing: Updates to GOVERNANCE.md, CONTRIBUTING.md, or CODEOWNERS. (Requires Governance Council approval)
  • Capability: New schemas (Discovery, Cart, etc.) or extensions. (Requires Maintainer approval)
  • Documentation: Updates to README, or documentations regarding schema or capabilities. (Requires Maintainer approval)
  • Infrastructure: CI/CD, Linters, or build scripts. (Requires DevOps Maintainer approval)
  • Maintenance: Version bumps, lockfile updates, or minor bug fixes. (Requires DevOps Maintainer approval)
  • SDK: Language-specific SDK updates and releases. (Requires DevOps Maintainer approval)
  • Samples / Conformance: Maintaining samples and the conformance suite. (Requires Maintainer approval)
  • UCP Schema: Changes to the ucp-schema tool (resolver, linter, validator). (Requires Maintainer approval)
  • Community Health (.github): Updates to templates, workflows, or org-level configs. (Requires DevOps Maintainer approval)

Related Issues

Checklist

  • I have followed the Contributing Guide (including Conventional Commits title requirements and ! for breaking changes).
  • I have updated the documentation (if applicable).
  • My changes pass all local linting and formatting checks.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • (For Core/Capability) I have included/updated the relevant JSON schemas.
  • I have regenerated Python Pydantic models by running generate_models.sh under python_sdk.

Screenshots / Logs (if applicable)

@gemini-code-assist
Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@pemamian pemamian marked this pull request as ready for review May 22, 2026 13:28
@pemamian pemamian requested review from a team as code owners May 22, 2026 13:28
Comment thread .github/workflows/scripts/pr-cron-stale-abandon.py
Comment thread .github/workflows/scripts/pr-cron-stale-abandon.py Outdated
ADDITIONAL_ABANDON_DAYS = 30
ABANDON_THRESHOLD_DAYS = STALE_THRESHOLD_DAYS + ADDITIONAL_ABANDON_DAYS

# Label Constants
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to create the labels before merging :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think github automatically creates labels that don't exist. (based on small tests I've done)

is_stale = updated_at < stale_limit
is_abandon_candidate = updated_at < abandon_limit

# Determine matching category
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have a label removal logic too? If the PR is active again?

Comment thread .github/workflows/scripts/pr-cron-stale-abandon.py

# Determine matching category
is_stale_review = is_stale and (LABEL_UNDER_REVIEW in labels)
is_blocked_abandon = is_abandon_candidate and (LABEL_BLOCKED in labels)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is abandon just for blocked PRs?


if missing_labels:
print(f'[ACTION] PR #{pr.number} "{pr.title}" is inactive. Adding missing labels: {missing_labels}')
# PyGithub add_to_labels accepts iterable of strings or label objects
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since iterables are accepted, why not pass them instead of making multiple API calls?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reduces unnecessary 'add' calls that could cause a notification.

Comment thread .github/workflows/scripts/pr-cron-stale-abandon.py
Comment thread .github/workflows/pr-cron-stale-abandon.yml
Comment thread .github/workflows/pr-cron-stale-abandon.yml Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants