Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Conversation

OsamaSayegh
Copy link
Member

No description provided.

Cloning very large repos is an expensive operation that can cause
significant overhead on the server. This change will make the plugin
use the GitHub API for granting badges. The way it works is it keeps
track of commits in the `github_commits` table, and then every 4 hours
it'll check for new commits and grant badges to users who qualify.
The first time the job is run it'll try to build the entire git histroy
in the table. If the GitHub API rate limit us, then the next run will
resume building the history from where it stopped last time.

Providing a GitHub token via site settings is required in order for the
badges to be granted to users. The token doesn't need any permissions
unless one of the target repos is private.
@robbiet480
Copy link

@OsamaSayegh One request: Now that it's API based and doesn't require clones, it would be great to support the same syntax as the linkback feature to define what repos to watch. I mostly just want that to be able to monitor home-assistant/* instead of having to list all 100 or however many repos we have over at @home-assistant.

@SamSaffron
Copy link
Member

@majakomel can you review this PR ?

This setting will make the "Settings" button show up for this plugin at
/admin/plugins
BADGE_NAME_SILVER ||= 'Great contributor'.freeze
BADGE_NAME_GOLD ||= 'Amazing contributor'.freeze

COMMITER_BADGE_NAME_BRONZE ||= 'Committer'.freeze
Copy link
Member

Choose a reason for hiding this comment

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

note ... no need for .freeze here # frozen_string_literal: true


def is_pr?(commit)
commit.commit.author.name != commit.commit.committer.name && commit.commit.committer.name != "GitHub"
# GitHub has a special account that acts as the committer of commits that are
Copy link
Member

Choose a reason for hiding this comment

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

good use of comment here

@SamSaffron
Copy link
Member

I say do the minor fixed to remove the .freezes and go ahead and merge.

@OsamaSayegh OsamaSayegh merged commit 59be52d into master Jun 26, 2019
@OsamaSayegh OsamaSayegh deleted the github-api-no-more-clone branch June 26, 2019 12:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants