Skip to content
codypearsonPublic

About

Script for reviewing the R&T queue

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

rt-queue

CLI that scans configured GitHub repositories for open pull requests and prints Jira parent tickets ready for Review & Test.

How it works

  1. For each configured owner/repo, fetch open, non-draft pull requests not authored by you.
  2. Resolve each PR to a Jira parent issue:
    • Prefer an issue that shows the PR in Jira (development panel or remote link).
    • Otherwise use the first Jira key in the PR title.
    • Subtask links are promoted to their parent.
  3. Keep parents whose status is Pending Review (configurable).
  4. Apply the same subtask rules as before:
  • A subtask whose summary matches any configured R&T keyword group (default review,test, code,review) in status To Do
  • That R&T subtask is unassigned or assigned to you
  • Every other subtask under the parent is Done, except Deploy subtasks (configured issue type, or a summary of exactly Deploy) and ignored subtasks (default stakeholder,review), which may be in any status
  • You were never assignee on any other non-ignored subtask under the same parent (assignee was currentUser() in Jira history), unless you use --include-worked-on

Ignored subtasks (default Stakeholder Review) are never a queue trigger, never a sibling blocker, and never disqualifying history.

Output is one block per qualifying PR on stdout: parent URL, parent summary, and PR URL, then one indented line per completed work subtask (issue key, summary, and who last moved it to Done from Jira status history). Sorted by oldest pull request first, then oldest Jira parent update. Multiple PRs on the same parent produce multiple blocks.

Setup

Install

Install with pipx so rt-queue is available globally without activating a virtualenv:

pipx install rt-queue

From a clone of this repository:

pipx install .

From GitHub (no clone required):

pipx install git+https://github.com/codypearson/rt-queue.git

If you do not have pipx yet, see the pipx installation guide.

Configuration

cp .env.example .env
# Edit .env: GITHUB_TOKEN, GITHUB_REPOSITORIES,
# JIRA_BASE_URL, JIRA_EMAIL, JIRA_API_TOKEN,
# and either JIRA_DEPLOY_ISSUE_TYPE_NAME or JIRA_DEPLOY_ISSUE_TYPE_ID

Run rt-queue from any directory; it loads .env from the current working directory.

GitHub token (GITHUB_TOKEN)

The CLI uses GraphQL to list open pull requests and load commit messages in the same request. It also calls GET /user (unless you set GITHUB_LOGIN).

Fine-grained personal access token (recommended for least privilege):

Scope Setting
Resource owner Your org or user that owns the repos
Repository access Only select repositories — include every repo listed in GITHUB_REPOSITORIES
Repository permissions → Pull requests Read
Repository permissions → Contents Read (required for pull request commit messages in GraphQL)
Repository permissions → Metadata Read (required whenever other repo permissions are granted)
Account permissions → Profile Read (only if you omit GITHUB_LOGIN; used to learn your login so your own PRs are excluded)

No other repository or account permissions are required. You do not need Issues or Actions access.

Classic personal access token alternative: grant the repo scope (or public_repo if every configured repository is public). Classic tokens cannot be limited to a subset of repositories the way fine-grained tokens can.

Store the token in .env as GITHUB_TOKEN. Never commit it.

Development

For local development with an editable install:

python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Usage

rt-queue

To include parents where you were assignee on other subtasks:

rt-queue --include-worked-on

Example output:

https://imh-internal.atlassian.net/browse/PROJ-123  Add widget to catalog  (PR: https://github.com/inmotionhosting/product-catalog/pull/456)
  PROJ-124  Implement the widget  — Done by: Jane Doe
  PROJ-125  Write tests  — Done by: Alex Kim

Run rt-queue --help for environment variable documentation.

Configuration

Variable Required Default
GITHUB_TOKEN yes —
GITHUB_REPOSITORIES yes —
GITHUB_LOGIN no from GET /user
JIRA_BASE_URL yes —
JIRA_EMAIL yes —
JIRA_API_TOKEN yes —
JIRA_PARENT_STATUS_NAME no Pending Review
JIRA_DEPLOY_ISSUE_TYPE_NAME or JIRA_DEPLOY_ISSUE_TYPE_ID yes (one of) — / —
JIRA_RT_SUMMARY_KEYWORDS no review,test;code,review
JIRA_IGNORED_SUMMARY_KEYWORDS no stakeholder,review
JIRA_RT_STATUS_NAME no To Do,Qualified (comma-separated)
JIRA_ACCOUNT_ID no from GET /rest/api/3/myself

Requirements

  • GitHub REST API (see GitHub token above for fine-grained PAT permissions)
  • Jira Cloud with REST API v3
  • Python 3.11+

About

Script for reviewing the R&T queue

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages