Skip to content
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

add first WIP for allowing to get stats about created releases #314

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

szaimen
Copy link

@szaimen szaimen commented Aug 24, 2023

Close #310

@szaimen
Copy link
Author

szaimen commented Aug 24, 2023

Hi @psss can you please give me same additional pointers where I need to modify the code so that it starts working? Thanks in advance! :)

Signed-off-by: Simon L <szaimen@e.mail.de>
@szaimen szaimen force-pushed the enh/310/search-for-releases branch from 6764221 to baeb398 Compare August 24, 2023 09:40
@psss
Copy link
Owner

psss commented Sep 8, 2023

Thanks for the draft! You just need to include the new stats in the GitHubStats class at the bottom of the file:

did/did/plugins/github.py

Lines 244 to 266 in a3a49fa

self.stats = [
IssuesCreated(
option=option + "-issues-created", parent=self,
name="Issues created on {0}".format(option)),
IssueCommented(
option=option + "-issues-commented", parent=self,
name="Issues commented on {0}".format(option)),
IssuesClosed(
option=option + "-issues-closed", parent=self,
name="Issues closed on {0}".format(option)),
PullRequestsCreated(
option=option + "-pull-requests-created", parent=self,
name="Pull requests created on {0}".format(option)),
PullRequestsCommented(
option=option + "-pull-requests-commented", parent=self,
name="Pull requests commented on {0}".format(option)),
PullRequestsClosed(
option=option + "-pull-requests-closed", parent=self,
name="Pull requests closed on {0}".format(option)),
PullRequestsReviewed(
option=option + "-pull-requests-reviewed", parent=self,
name="Pull requests reviewed on {0}".format(option)),
]

Also make sure, that you correctly extract the list of projects from the project config value. You get inspiration here:

did/did/plugins/github.py

Lines 235 to 239 in a3a49fa

try:
self.url = config["url"]
except KeyError:
raise ReportError(
"No github url set in the [{0}] section".format(option))

Let me know if anything else is not clear.

Copy link
Owner

@psss psss left a comment

Choose a reason for hiding this comment

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

Nice kick-off! Thanks! In order to make it work we need the Release class though plus enabled the new stats under the GitHubStats class.

@@ -9,6 +9,7 @@
url = https://api.github.com/
token = <authentication-token>
login = <username>
project = <project1, project2>
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
project = <project1, project2>
project = <project1>, <project2>

Let's make it a bit more clear that comma is a project separator here.

query = "repos/{0}/releases?q=author:{1}+created:{2}..{3}".format(
project, self.user.login, self.options.since, self.options.until)
self.stats = [
Releases(release) for release in self.parent.github.search(query)]
Copy link
Owner

Choose a reason for hiding this comment

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

Is seems that you need to define the Release class as well. It could be similar to the Issue class above.

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.

Allow to report created github releases
2 participants