Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions skills/check-release/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ recommendations, writing notes, the noticed-fixes PR and the site checks.

- **Merged PRs only:** a Memgraph PR counts once `merged_at != null`. PRs
closed without merging are ignored entirely.
- **Stacked PRs:** a PR into another PR's branch ships with the PR that takes
that branch to `master` or a release branch. The script follows the chain
and leaves out PRs whose last PR is in another milestone; that PR carries
the docs label and release note.
- **Docs labels:** every merged PR carries exactly one of `Docs needed`,
`Docs - changelog only` or `Docs unnecessary`. `Docs needed` means a docs
PR and a release note; `Docs - changelog only` means a release note;
Expand Down Expand Up @@ -312,6 +316,8 @@ report:
- **Progress:** the step 1 numbers, as in the overview.
- **Docs labels:** missing or questionable labels, the recommended label and
a one-line reason.
- **Stacked PRs:** PRs left out because they ship in another milestone (ask
to move them), and PRs whose branch has no PR toward `master`.
- **Release notes:** PRs with no entry, breaking changes outside the Breaking
section, `Docs needed` entries with no docs link, and docs PRs with release
note corrections for entries already written (check the entry follows
Expand Down
38 changes: 37 additions & 1 deletion skills/check-release/scripts/overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
--json writes the findings (to-do lists, labels to check, noticed items) for
the report.
"""
import argparse, datetime, json, re, subprocess, sys, tempfile
import argparse, datetime, functools, json, re, subprocess, sys, tempfile

MG, DOCS = 'memgraph/memgraph', 'memgraph/documentation'
DOCS_LABELS = ('Docs needed', 'Docs - changelog only', 'Docs unnecessary')
Expand Down Expand Up @@ -73,6 +73,40 @@ def paginate(path):
continue # closed without merging
prs[i['number']] = dict(title=i['title'], author=i['user']['login'],
labels=[l['name'] for l in i['labels']], status=status)


# Stacked PRs: a PR into another PR's branch ships with the PR that takes that
# branch to master or a release branch, so it counts in that PR's milestone.
@functools.cache
def pr_for_branch(branch):
found = [p for p in gh('pr', 'list', '--repo', MG, '--head', branch, '--state', 'all',
'--json', 'number,state,baseRefName,milestone') if p['state'] != 'CLOSED']
return found[0] if found else None


def ships_via(base):
top, seen = None, set()
while base != 'master' and not base.startswith('release/') and base not in seen:
seen.add(base)
top = pr_for_branch(base)
if not top:
return 'none', None
base = top['baseRefName']
return (top['number'], (top.get('milestone') or {}).get('title')) if top else (None, None)


bases = gh('pr', 'list', '--repo', MG, '--state', 'all', '--limit', '1000',
'--search', f'milestone:"{args.milestone}"', '--json', 'number,baseRefName')
stacked_elsewhere, stacked_no_path = [], []
for b in bases:
if b['number'] not in prs:
continue
top, ms = ships_via(b['baseRefName'])
if top == 'none':
stacked_no_path.append(dict(pr=b['number'], base=b['baseRefName']))
elif top and ms != args.milestone:
stacked_elsewhere.append(dict(pr=b['number'], ships_via=top, milestone=ms))
del prs[b['number']]
merged = {n for n, p in prs.items() if p['status'] == 'merged'}
has = lambda n, label: label in prs[n]['labels']

Expand Down Expand Up @@ -216,6 +250,8 @@ def bar(a, b):
docs_prs_naming_prs_outside_milestone=[dict(docs_pr=d, product=p) for d, p in outside],
docs_prs_without_milestone=sorted(d for d, i in docs_info.items() if i['base'] == branch and i['milestone'] != version),
docs_prs_with_wrong_base=sorted(d for d, i in docs_info.items() if i['milestone'] == version and i['base'] != branch),
stacked_in_other_milestone=sorted(stacked_elsewhere, key=lambda s: s['pr']),
stacked_without_path_to_master=sorted(stacked_no_path, key=lambda s: s['pr']),
missing_label=missing_label, several_labels=several_labels,
questionable_labels=[dict(pr=n, reason=r, title=prs[n]['title'], labels=prs[n]['labels']) for n, r in questionable],
noticed=[dict(docs_pr=d, item=i) for d, i in noticed],
Expand Down