Skip to content

Finish milestone#178

Open
jennyhickson wants to merge 20 commits intoMetOffice:mainfrom
jennyhickson:finish_milestone
Open

Finish milestone#178
jennyhickson wants to merge 20 commits intoMetOffice:mainfrom
jennyhickson:finish_milestone

Conversation

@jennyhickson
Copy link
Collaborator

@jennyhickson jennyhickson commented Feb 3, 2026

PR Summary

Sci/Tech Reviewer:
Code Reviewer: @james-bruten-mo

New script for closing a milestone from the Review Tracker project during a release. It:

  • checks if there are still open PRs against the milestone
  • checks if there are closed PRs against another milestone (should they be changed?)
  • reports on the number of PRs closed for the milestone
  • archives all closed PRs for the milestone
  • gives the command for closing the milestone in each repo

To do this it also improves the project data class, simplifying the data structure, including functions for handling milestones and storing the PR details in objects rather than a dictionary.

The user will need to authenticate themselves to modify the project, github prompts for this on first use.

Code Quality Checklist

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid understanding and enhance the readability of the code
  • My changes generate no new warnings
  • All automated checks in the CI pipeline have completed successfully

Testing

  • This change has been tested appropriately (please describe)

Security Considerations

  • I have reviewed my changes for potential security issues
  • Sensitive data is properly handled (if applicable)
  • Authentication and authorisation are properly implemented (if applicable)

AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance of Generative AI tool name (e.g., Met Office Github Copilot Enterprise, Github Copilot Personal, ChatGPT GPT-4, etc) and I have followed the Simulation Systems AI policy (including attribution labels)

Sci/Tech Review

  • I understand this area of code and the changes being added
  • The proposed changes correspond to the pull request description
  • Documentation is sufficient (do documentation papers need updating)
  • Sufficient testing has been completed

(Please alert the code reviewer via a tag when you have approved the SR)

Code Review

  • All dependencies have been resolved
  • Related Issues have been properly linked and addressed
  • Code quality standards have been met
  • Tests are adequate and have passed
  • Security considerations have been addressed
  • Performance impact is acceptable

Copy link
Collaborator

@james-bruten-mo james-bruten-mo left a comment

Choose a reason for hiding this comment

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

Just a couple of suggestions

import shlex
from collections import defaultdict

project_id = 376
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
project_id = 376
PROJECT_ID = 376

from collections import defaultdict

project_id = 376
project_owner = "MetOffice"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
project_owner = "MetOffice"
PROJECT_OWNER = "MetOffice"

raise RuntimeError(
"Error fetching GitHub Project data: \n " + output.stderr.decode()
)
command = f"gh project item-list {project_id} -L 500 --owner {project_owner} --format json"
Copy link
Collaborator

Choose a reason for hiding this comment

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

It feels like project_id/owner should be inputs to this function, rather than hard-coded to the global variable.
Maybe def from_github(cls, project_id=PROJECT_ID, project_owner=PROJECT_OWNER...)?

"""

data = defaultdict(list)
data = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would pull_requests or pull_requests_data be a clearer name?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess same with self.data? If it's not just pr's then fair enough

dry_run: If true, print the command used rather than archiving.
"""

command = f"gh project item-archive {project_id} --owner {project_owner} --id {self.id}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar comments around project_owner/id as above

pr.archive(dry_run)


class PullRequest:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably wants a docstring

self.scitechReview = None
self.codeReview = None

def archive(self, dry_run: bool = False):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def archive(self, dry_run: bool = False):
def archive(self, dry_run: bool = False) -> None:

exceptions.
"""
total_open = still_open(open_prs[milestone], milestone)
total_other = closed_other(closed_prs, milestone)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to update the milestone on these PRs to match the closing milestone? I guess you'd logically do it after the check_ready step and before report?

* Remaining open PRs and issues against this milestone
* Closed PRs against this milestone
"""
from collections import defaultdict
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure you're using this in this file?

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