Skip to content

Add new stream for pr-files#7

Open
leomattic wants to merge 3 commits into
masterfrom
new/pr-files-stream
Open

Add new stream for pr-files#7
leomattic wants to merge 3 commits into
masterfrom
new/pr-files-stream

Conversation

@leomattic
Copy link
Copy Markdown

Priority

Non-urgent, nice to have one day.

Description of change

It would be fun to have the number of lines added and deleted per pr. This would allow us to aggregate them by repo or team and see the ebbs and flows of our development.

I naively tried to add it in the pull requests themselves:

It looks like we have to dig a little deeper. The best would be to get the details of each commit but that sounds too expensive as there can be many per pull request.

Another option would be to get the details of each file in a pul request. It looks like we can use the endpoint in a similar way we are already doing with pr_commits to have a new stream pr_files.

https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests-files

https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/commits
https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/files

Manual QA steps

Note: I have not tested this, it's my first attempt and should be taken more like pseudo code than anything else.

Risks

Rollback steps

  • revert this branch

@leomattic leomattic self-assigned this Aug 28, 2024
@leomattic leomattic requested a review from joaopamaral August 28, 2024 14:47
Copy link
Copy Markdown

@joaopamaral joaopamaral left a comment

Choose a reason for hiding this comment

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

This is a great contribution @leomattic! 🚀 Thank you so much!
I've only added a small change to fix the schema (I ran a local test).
cbeb336

@leomattic
Copy link
Copy Markdown
Author

leomattic commented Aug 30, 2024

Thank you for all the help @joaopamaral !!
If you test it and it works with the updates then I would love to merge it!! 🥳

How would it work btw? will it detect it's missing data for the existing PRs and do a backfill or will the data be available only for new PRs?

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