Skip to content

Add a script for generating the PR report - #145

Merged
Cadair merged 1 commit into
OpenAstronomy:mainfrom
Cadair:pr_report_helper
Oct 12, 2026
Merged

Cadair merged 1 commit into
OpenAstronomy:mainfrom
Cadair:pr_report_helper

Conversation

@Cadair

@Cadair Cadair commented Oct 8, 2026

Copy link
Copy Markdown
Member

No description provided.

@Cadair
Cadair requested a review from pllim October 8, 2026 14:49

@pllim pllim left a comment

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.

Thank you!!!

@pllim

pllim commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Maybe a note about this tool on README? :D

@Cadair
Cadair force-pushed the pr_report_helper branch 2 times, most recently from 50e195f to 1922467 Compare October 8, 2026 15:03
@Cadair

Cadair commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

I'm getting some errors testing this out:

python tools/generate_pr_report.py sunpy/sunpy 8818
Traceback (most recent call last):
  File "/home/stuart/Git/baldrick/tools/generate_pr_report.py", line 40, in <module>
    report_pr_stats(args.repo_name, int(args.pr_number))
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stuart/.local/share/mamba/envs/baldrick/lib/python3.14/unittest/mock.py", line 1439, in patched
    return func(*newargs, **newkeywargs)
  File "/home/stuart/Git/baldrick/tools/generate_pr_report.py", line 25, in report_pr_stats
    **activity_counts(pr_handler, repo_handler),
      ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stuart/Git/baldrick/baldrick/plugins/github_org_vetting.py", line 79, in activity_counts
    counts[f"{kind}_{period}"] = repo_handler.count_opened_by(pr_handler.user, kind, now - delta)
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stuart/Git/baldrick/baldrick/github/github_api.py", line 101, in count_opened_by
    response.raise_for_status()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/stuart/.local/share/mamba/envs/baldrick/lib/python3.14/site-packages/requests/models.py", line 1167, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.github.com/search/issues?q=author%3Abhuvan-somisetty+type%3Apr+created%3A%3E%3D2026-10-07T15%3A05%3A19Z&per_page=1

@pllim

This comment was marked as outdated.

@pllim

pllim commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

I did not use this script per se but I used the same logic manually just now and able to get the stats for astropy/astropy#20446 (comment)

@pllim

pllim commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Ohhh... the author set activities to private: https://github.com/bhuvan-somisetty

Maybe baldrick can just auto red flag such things.

@Cadair

Cadair commented Oct 8, 2026 •

Copy link
Copy Markdown
Member Author

oh interesting we should probably catch that somehow. @astrofrog

@Cadair

Cadair commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

@pllim do you want me to edit this to print out the whole comment in markdown?

@pllim

pllim commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

whole comment in markdown?

Might help, yes.

@pllim

pllim commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

I opened #146 as follow-up issue about private activities.

@bsipocz

bsipocz commented Oct 9, 2026

Copy link
Copy Markdown
Member

Ohhh... the author set activities to private: bhuvan-somisetty

Maybe baldrick can just auto red flag such things.

I know we said that some of these accounts are hijacked, but I would still think that we should flag new github accounts, lets say newer than 2 months, half a year, something like that.

@Cadair
Cadair merged commit f50e0da into OpenAstronomy:main Oct 12, 2026
12 checks passed
@Cadair
Cadair deleted the pr_report_helper branch October 12, 2026 10:14
@pllim

pllim commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

For completeness, I also opened #147 as follow-up. Thanks, all!

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.

3 participants