Skip to content

Add workflow to check that issues tied to PRs have a milestone #2590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 30, 2025

Conversation

amontanez24
Copy link
Contributor

@amontanez24 amontanez24 commented Jun 25, 2025

resolves #2585
Comment if issue not linked is below

Example run that errored because there was no milestone:
https://github.com/sdv-dev/SDV/actions/runs/15889541001/job/44809256289

Example run that passed from PR push
https://github.com/sdv-dev/SDV/actions/runs/15891716052

Copy link

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.11%. Comparing base (03d10ef) to head (13eb4d9).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2590   +/-   ##
=======================================
  Coverage   98.11%   98.11%           
=======================================
  Files          70       70           
  Lines        7275     7275           
=======================================
  Hits         7138     7138           
  Misses        137      137           
Flag Coverage Δ
integration 76.17% <ø> (-0.09%) ⬇️
unit 96.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@amontanez24 amontanez24 requested review from rwedge June 26, 2025 02:50
@amontanez24 amontanez24 marked this pull request as ready for review June 26, 2025 02:50
@amontanez24 amontanez24 requested a review from a team as a code owner June 26, 2025 02:50
@amontanez24 amontanez24 requested review from R-Palazzo June 26, 2025 02:51
@sdv-team
Copy link
Contributor

This Pull Request is not linked to an issue. To ensure our community is able to accurately track resolved issues, please link any that will be closed by this PR!

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install requests==2.31.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to pin this? There's already been several new releases of requests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we test the scenario where a linked issue does not have a milestone?

Copy link
Contributor

@R-Palazzo R-Palazzo left a comment

Choose a reason for hiding this comment

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

Looks good!

def _post_comment(github_client: GithubClient, pr_number: int):
comment = (
'This Pull Request is not linked to an issue. To ensure our community is able to '
'accurately track resolved issues, please link any that will be closed by this PR!'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'accurately track resolved issues, please link any that will be closed by this PR!'
'accurately track resolved issues, please link any issue that will be closed by this PR!'

Comment on lines 66 to 71
if not issue.get('milestone'):
raise Exception(f'No milestone attached to issue number {issue.get("number")}')
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also verify that all issues are linked to the same milestone? I'm considering cases where a feature branch resolves many issues in one PR, and we may want to ensure they all have the same milestone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added here

Comment on lines 11 to 12
preparerelease:
runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we prevent this from being run on dependency updates?

Suggested change
preparerelease:
runs-on: ubuntu-latest
preparerelease:
runs-on: ubuntu-latest
if: "!startsWith(github.head_ref, 'latest-dependency-update-')"

):
pr_number = pr_number
results = graph_client.query(
query=CLOSING_ISSUES_QUERY, owner='sdv-dev', repo='sdv', prNumber=pr_number
Copy link
Contributor

Choose a reason for hiding this comment

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

Should owner and repo be a global variable (at top, set once)?

@amontanez24 amontanez24 requested a review from gsheni June 30, 2025 20:11
query_params = {'milestone': milestone_title, 'state': 'all', 'per_page': 100}
response = requests.get(url, headers=headers, params=query_params, timeout=10)
response = client.get(
github_org='sdv-dev', repo='sdv', endpoint='milestones', query_params=query_params
Copy link
Contributor

Choose a reason for hiding this comment

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

Org and repo should be global variables

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry missed this file

@amontanez24 amontanez24 force-pushed the issue-2585-check-milestones branch from 889098f to 13eb4d9 Compare June 30, 2025 21:00
@amontanez24 amontanez24 merged commit d3c2bc0 into main Jun 30, 2025
47 checks passed
@amontanez24 amontanez24 deleted the issue-2585-check-milestones branch June 30, 2025 21:42
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.

Add workflow to check that issues tied to PRs have a milestone
5 participants