zimbatm
November 14, 2018, 4:27pm
1
I enabled a few options on the GitHub plugin, let me know if you see any issues.
Github Badges: users should get additional badges based on their contributions, not sure how this will look like
GitHub Linkback: Discourse should post on NixOS/* and nix-community/* issues linking back to threads. TODO: create new github account as it’s using mine currently
GitHub Permalink: Discourse will transform links to code to perma-links to make the historical context more precise
4 Likes
vcunat
November 14, 2018, 4:31pm
2
Linkback: you may want to do that under a separate user, for a number of reasons. (Security, participating status, etc.) example link
1 Like
vcunat
November 14, 2018, 4:32pm
3
Badges: I guess that’s the “Great contributor” tag next to our names.
zimbatm
November 14, 2018, 4:34pm
4
Creating the account currently. I didn’t understand that it was going this way around
1 Like
zimbatm
November 14, 2018, 4:40pm
5
Fixed. I now hold nixos-discourse · GitHub . It would be great if I could share the account’s password with the hardware team.
jtojnar
December 25, 2018, 6:33pm
6
There seems to be an issue where it sends new and new comments when a post on Discourse is edited: whipper: 0.7.0 -> 0.7.2 by Moredread · Pull Request #51302 · NixOS/nixpkgs · GitHub
zimbatm
December 25, 2018, 10:14pm
7
jtojnar
December 25, 2018, 10:43pm
8
Not a rubyist but I’d guess it might be that the script is checking for URL including a fragment:
Jobs.enqueue(:create_github_linkback, post_id: @post.id) if should_enqueue?
end
def github_links
projects = SiteSetting.github_linkback_projects.split('|')
return [] if projects.blank?
result = {}
PrettyText.extract_links(@post.cooked).map(&:url).each do |l|
next if @post.custom_fields[GithubLinkback.field_for(l)].present?
if l =~ /https?:\/\/github\.com\/([^\/]+)\/([^\/]+)\/commit\/([0-9a-f]+)/
project = "#{Regexp.last_match[1]}/#{Regexp.last_match[2]}"
if is_allowed_project_link?(projects, project)
link = Link.new(Regexp.last_match[0], project, :commit)
link.sha = Regexp.last_match[3]
result[link.url] = link
end
elsif l =~ /https?:\/\/github.com\/([^\/]+)\/([^\/]+)\/pull\/(\d+)/
project = "#{Regexp.last_match[1]}/#{Regexp.last_match[2]}"
But only storing the flag for fragment-less URL:
links.each do |link|
next unless [:commit, :pr].include?(link.type)
if link.type == :commit
post_commit(link)
elsif link.type == :pr
post_pr(link)
end
# Don't post the same link twice
@post.custom_fields[GithubLinkback.field_for(link.url)] = 'true'
@post.save_custom_fields
end
links
end
def self.field_for(url)
"github-linkback:#{Digest::SHA1.hexdigest(url)[0..15]}"
end
elsif l =~ /https?:\/\/github.com\/([^\/]+)\/([^\/]+)\/pull\/(\d+)/
project = "#{Regexp.last_match[1]}/#{Regexp.last_match[2]}"
if is_allowed_project_link?(projects, project)
link = Link.new(Regexp.last_match[0], project, :pr)
jtojnar
December 25, 2018, 10:46pm
9
Editing the comment to remove the URL fragment indeed does not trigger the bot.
zimbatm
December 26, 2018, 1:26pm
10
Maybe create a new test github issue and discourse post to reproduce the issue?
jtojnar
January 29, 2020, 11:45pm
11
How often does Discord synchronise with Github? I have several accepted PRs but I don’t have a badge fsr.
1 Like
lom
November 28, 2021, 1:24pm
13
The last person to get it was 9 days ago, are you sure that you linked your GitHub account in the profile preferences?
@flexagoon
Edit: I just got mine, maybe two hours after I linked my account
Hmm, I tried relinking my GitHub account a few weeks ago, and I still didn’t get the badge so far.
I guess for some reason discourse-github
doesn’t like my account.
I relinked the account yet again but also added my commit email address to this Discourse. Not sure if that made the difference but I got the badge now.
1 Like