A platform for community discussion. Free, open, simple.
DEV: Move discourse-github to core (#33749)
Jarek Radosz97b1f04f8d77
diff --git a/.github/labeler.yml b/.github/labeler.ymlindex 1041fd1cad8..812880f90fb 100644--- a/.github/labeler.yml+++ b/.github/labeler.yml@@ -114,6 +114,10 @@ discourse-policy:- changed-files:- any-glob-to-any-file: plugins/discourse-policy/**/*+discourse-github:+ - changed-files:+ - any-glob-to-any-file: plugins/discourse-github/**/*+footnote:- changed-files:- any-glob-to-any-file: plugins/footnote/**/*diff --git a/.gitignore b/.gitignoreindex 3c5cc1db61f..ed6bff6043c 100644--- a/.gitignore+++ b/.gitignore@@ -71,6 +71,7 @@!/plugins/discourse-gamification!/plugins/discourse-calendar!/plugins/discourse-policy+!/plugins/discourse-github/plugins/*/auto_generated/spec/fixtures/plugins/my_plugin/auto_generateddiff --git a/Gemfile b/Gemfileindex 4304dc07975..8aa36f203c1 100644--- a/Gemfile+++ b/Gemfile@@ -290,3 +290,7 @@ gem "zendesk_api", "1.38.0.rc1", require: false# for discourse-subscriptionsgem "stripe", "11.1.0", require: false++# for discourse-github+gem "sawyer", "0.9.2", require: false+gem "octokit", "5.6.1", require: falsediff --git a/Gemfile.lock b/Gemfile.lockindex 35ee6b865c5..f70a9df01bc 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -335,6 +335,9 @@ GEMmulti_json (~> 1.3)multi_xml (~> 0.5)rack (>= 1.2, < 4)+ octokit (5.6.1)+ faraday (>= 1, < 3)+ sawyer (~> 0.9)oj (3.16.11)bigdecimal (>= 3.0)ostruct (>= 0.2)@@ -583,6 +586,9 @@ GEMgoogle-protobuf (~> 4.29)sassc-embedded (1.80.2)sass-embedded (~> 1.80)+ sawyer (0.9.2)+ addressable (>= 2.3.5)+ faraday (>= 0.17.3, < 3)securerandom (0.4.1)shoulda-matchers (6.5.0)activesupport (>= 5.2.0)@@ -751,6 +757,7 @@ DEPENDENCIESnet-popnet-smtpnokogiri+ octokit (= 5.6.1)ojomniauthomniauth-facebook@@ -798,6 +805,7 @@ DEPENDENCIESrubyzipsanitizesassc-embedded+ sawyer (= 0.9.2)shoulda-matcherssidekiqsimplecov@@ -986,6 +994,7 @@ CHECKSUMSoauth (1.1.0) sha256=38902b7f0f5ed91e858d6353f5e1e06b2c16a8aa0fd91984671eab1a1d1cddeboauth-tty (1.0.5) sha256=34e25c307da4509d4deec266ff3690bbf42e391355f496201c029268862d8b17oauth2 (1.4.11) sha256=6739fcc8872bc94f476b0cae3e8bd78a56d8364b1b79b0757794c25e152d5c10+ octokit (5.6.1) sha256=48efb2c2aa83c2c394358f073d35ad71d4ac0f14870cd00ceebd3ef3949fe495oj (3.16.11) sha256=2aab609d2bc896529bd3c70d737f591c13932a640ba6164a0f7e414efdb052b1omniauth (2.1.2) sha256=def03277298b8f8a5d3ff16cdb2eb5edb9bffed60ee7dda24cc0c89b3ae6a0ceomniauth-facebook (9.0.0) sha256=440ad8dd9edc9ebec1fd6607b787667c8ce70d2969c2030d7e9ca42a271af854@@ -1084,6 +1093,7 @@ CHECKSUMSsass-embedded (1.85.0-x86_64-linux-gnu) sha256=30e2b01b9d487cce2a421c5dda7bc2d0f64b52450174bde83fe3a299789e4294sass-embedded (1.85.0-x86_64-linux-musl) sha256=ca01931c54b59db1130a779386bcfc798f8dcfee1f98f60fbcf8c5dbdc0f9c23sassc-embedded (1.80.2) sha256=625ac3923fe9af1a8072210cf22b01b66f3dc23748a4997a9b28bfdff7c7967d+ sawyer (0.9.2) sha256=fa3a72d62a4525517b18857ddb78926aab3424de0129be6772a8e2ba240e7acasecurerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1shoulda-matchers (6.5.0) sha256=ef6b572b2bed1ac4aba6ab2c5ff345a24b6d055a93a3d1c3bfc86d9d499e3f44sidekiq (7.3.9) sha256=1108712e1def89002b28e3545d5ae15d4a57ffd4d2c25d97bb1360988826b5a7diff --git a/plugins/discourse-github/README.md b/plugins/discourse-github/README.mdnew file mode 100644index 00000000000..9d66756ac4e--- /dev/null+++ b/plugins/discourse-github/README.md@@ -0,0 +1,51 @@+# Discourse Github++https://meta.discourse.org/t/discourse-github/99895/++This plugin combines functionality of deprecated github_badges and discourse-github-linkback plugins.++### Installation++Follow the [plugin installation guide](https://meta.discourse.org/t/install-a-plugin/19157).++### Github Badges++Assign badges to your users based on GitHub contributions.++#### How to use:++1. Enable `github badges enabled` in Settings -> Plugins.++2. Generate an access token on Github. Be sure to give it only the `public_repo` scope. Paste that token into the `github linkback access token` setting.++3. Add URL of the GitHub repo to scan for contributions to the `github badges repo` site setting.++### Github Linkback++Create a link from a Github pull request or commit back to a Discourse post where it is mentioned.++#### How to use:++1. Enable `github linkback enabled` in Settings -> Plugins.++2. Generate an [access token](https://github.com/settings/tokens) on Github.+ Be sure to give it <em>only</em> the `public_repo` scope. Paste that token into the+ `github linkback access token` setting.++3. Finally, add the projects you wish to post to in the `github linkback projects` site setting in the formats:+ - `username/repository` for specific repositories+ - `username/*` for all repositories of a certain user++### Github Permalink++Replace Github non-permalinks with [permalinks](https://help.github.com/articles/getting-permanent-links-to-files/).++#### How to use:++1. Enable `github permalinks enabled` in Settings -> Plugins.+2. If you want to exclude certain files or directories from permalink overwrites, you can modify that in the `github permalinks exclude` site setting in the following formats:+ - `filename` links to all files with matching filename+ - `username/*` links to all repositories belonging to the user/organization+ - `username/repository/*` links to any file in the repository+ - `username/repository/directory/*` links to any file in the directory within repository+ - `username/repository/file.rb` a specific filediff --git a/plugins/discourse-github/app/jobs/regular/create_github_linkback.rb b/plugins/discourse-github/app/jobs/regular/create_github_linkback.rbnew file mode 100644index 00000000000..cdfc308b84e--- /dev/null+++ b/plugins/discourse-github/app/jobs/regular/create_github_linkback.rb@@ -0,0 +1,12 @@+# frozen_string_literal: true++module Jobs+ class CreateGithubLinkback < ::Jobs::Base+ def execute(args)+ return unless SiteSetting.enable_discourse_github_plugin?+ return unless SiteSetting.github_linkback_enabled?+ return if (post = Post.find_by_id(args[:post_id])).blank?+ GithubLinkback.new(post).create+ end+ end+enddiff --git a/plugins/discourse-github/app/jobs/regular/replace_github_non_permalinks.rb b/plugins/discourse-github/app/jobs/regular/replace_github_non_permalinks.rbnew file mode 100644index 00000000000..70a82f81908--- /dev/null+++ b/plugins/discourse-github/app/jobs/regular/replace_github_non_permalinks.rb@@ -0,0 +1,93 @@+# frozen_string_literal: true++require "net/http"+require "json"+require "uri"++module Jobs+ class ReplaceGithubNonPermalinks < ::Jobs::Base+ sidekiq_options queue: "low"++ def execute(args)+ return unless SiteSetting.enable_discourse_github_plugin?+ return unless SiteSetting.github_permalinks_enabled?++ post_id = args[:post_id]+ raise Discourse::InvalidParameters.new(:post_id) if post_id.blank?++ post = Post.find_by(id: post_id)+ return if post.blank?++ raw = post.raw.dup+ start_raw = raw.dup++ regex =+ %r{github\.com/(?<user>[^/]+)/(?<repo>[^/\s]+)/blob/(?<sha1>[^/\s]+)/(?<file>[^#\s]+)(?<from-to>#(L([^-\s]*)(-L(\d*))?))?}i++ matches = post.raw.scan(regex)+ matches.each do |user, repo, sha1, file, from_to|+ next if excluded?(user, repo, file)++ begin+ api_url = "https://api.github.com/repos/#{user}/#{repo}/commits/#{sha1}"+ json = api_request(api_url)+ if json && (json["sha"] != sha1)+ new_sha = json["sha"]+ old_url = "github.com/#{user}/#{repo}/blob/#{sha1}/#{file}#{from_to}"+ new_url = "github.com/#{user}/#{repo}/blob/#{new_sha}/#{file}#{from_to}"+ raw.sub!(old_url, new_url)+ end+ rescue => e+ log(+ :error,+ "Failed to replace Github link with permalink in post #{post_id}\n" + e.message + "\n" ++ e.backtrace.join("\n"),+ )+ end+ end++ post.reload++ if start_raw == post.raw && raw != post.raw+ changes = { raw: raw, edit_reason: I18n.t("replace_github_link.edit_reason") }+ post.revise(Discourse.system_user, changes, bypass_bump: true)+ end+ end++ def excluded?(user, repo, file)+ excluded = SiteSetting.github_permalinks_exclude.split("|")++ excluded.each do |e|+ path_parts = e.split("/")+ # when only filename is provided+ if path_parts.length == 1+ return true if file == e+ next+ end++ path_parts.each { |p| p.sub!("*", "\\S+") }++ regex = Regexp.new(path_parts.join("\/"))+ return true if "#{user}/#{repo}/#{file}".match(regex)+ end++ false+ end++ private++ def api_request(url)+ uri = URI(url)+ response = Net::HTTP.get_response(uri)++ JSON.parse(response.body) if response.kind_of? Net::HTTPSuccess+ end++ def log(log_level, message)+ Rails.logger.public_send(+ log_level,+ "#{RailsMultisite::ConnectionManagement.current_db}: #{message}",+ )+ end+ end+enddiff --git a/plugins/discourse-github/app/jobs/scheduled/grant_github_badges.rb b/plugins/discourse-github/app/jobs/scheduled/grant_github_badges.rbnew file mode 100644index 00000000000..bc404b1228c--- /dev/null+++ b/plugins/discourse-github/app/jobs/scheduled/grant_github_badges.rb@@ -0,0 +1,16 @@+# frozen_string_literal: true++module DiscourseGithubPlugin+ class UpdateJob < ::Jobs::Scheduled+ every 4.hours++ def execute(args)+ return unless SiteSetting.enable_discourse_github_plugin?+ return unless SiteSetting.github_badges_enabled?+ return if SiteSetting.github_linkback_access_token.blank?++ GithubRepo.repos.each { |repo| CommitsPopulator.new(repo).populate! }+ GithubBadges.grant!+ end+ end+enddiff --git a/plugins/discourse-github/app/lib/commits_populator.rb b/plugins/discourse-github/app/lib/commits_populator.rbnew file mode 100644index 00000000000..d4c67e61345--- /dev/null+++ b/plugins/discourse-github/app/lib/commits_populator.rb@@ -0,0 +1,298 @@+# frozen_string_literal: true++module DiscourseGithubPlugin+ class CommitsPopulator+ MERGE_COMMIT_REGEX = /^Merge pull request/+ HISTORY_COMPLETE = "history-complete"+ class GraphQLError < StandardError+ end++ ROLES = { committer: 0, contributor: 1 }++ class PaginatedCommits+ def initialize(octokit, repo, cursor: nil, page_size: 100)+ @client = octokit+ @repo = repo+ @cursor = cursor+ @page_size = page_size+ raise ArgumentError, "page_size arg must be <= 100" if page_size > 100+ if cursor && !cursor.match?(/^\h{40}\s(\d+)$/)+ raise ArgumentError,+ "cursor must be a 40-characters hex string followed by a space and a number"+ end+ fetch_commits+ end++ def next+ cursor = next_cursor+ return unless cursor+ PaginatedCommits.new(@client, @repo, cursor: cursor, page_size: @page_size)+ end++ def commits+ @data.repository.defaultBranchRef.target.history.nodes+ end++ def next_cursor+ info = @data.repository.defaultBranchRef.target.history.pageInfo+ return unless info.hasNextPage+ info.endCursor+ end++ private++ def fetch_commits+ owner, name = @repo.name.split("/", 2)+ history_args = "first: #{@page_size}"+ history_args += ", after: #{@cursor.inspect}" if @cursor++ query = <<~QUERY+ query {+ repository(name: #{name.inspect}, owner: #{owner.inspect}) {+ defaultBranchRef {+ target {+ ... on Commit {+ history(#{history_args}) {+ pageInfo {+ endCursor+ hasNextPage+ }+ nodes {+ oid+ message+ committedDate+ associatedPullRequests(first: 1) {+ nodes {+ author {+ login+ }+ mergedBy {+ login+ }+ }+ }+ author {+ }+ }+ }+ }+ }+ }+ }+ }+ QUERY+ response = @client.post("/graphql", { query: query }.to_json)+ raise GraphQLError, response.errors.inspect if response.errors+ raise GraphQLError, response.message if !response.data+ @data = response.data+ end+ end++ def initialize(repo)+ @repo = repo+ @client =+ Octokit::Client.new(access_token: SiteSetting.github_linkback_access_token, per_page: 100)+ end++ def populate!+ return unless SiteSetting.github_badges_enabled?+ return if @client.branches(@repo.name).empty?++ if @repo.commits.size == 0+ build_history!+ else+ front_sha = Discourse.redis.get(front_commit_redis_key)+ if front_sha.present? && removed?(front_sha)+ # there has been a force push, next run will rebuild history+ @repo.commits.delete_all+ Discourse.redis.del(back_cursor_redis_key)+ Discourse.redis.del(front_commit_redis_key)+ return+ end+ fetch_new_commits!(front_sha)+ front_sha = Discourse.redis.get(front_commit_redis_key)+ @repo.reload++ back_cursor = Discourse.redis.get(back_cursor_redis_key)+ return if back_cursor == HISTORY_COMPLETE+ if back_cursor.present?+ build_history!(cursor: back_cursor)+ elsif front_sha.present?+ count = @repo.commits.count+ build_history!(cursor: "#{front_sha} #{count - 1}")+ else+ # this is a bad state that we should never be in+ # But in case it happens, easiest way to recover+ # is to start from scratch.+ @repo.commits.delete_all+ Discourse.redis.del(back_cursor_redis_key)+ Discourse.redis.del(front_commit_redis_key)+ end+ end+ rescue Octokit::Error => err+ case err+ when Octokit::NotFound+ disable_github_badges_and_inform_admin(+ title: I18n.t("github_commits_populator.errors.repository_not_found_pm_title"),+ raw:+ I18n.t(+ "github_commits_populator.errors.repository_not_found_pm",+ repo_name: @repo.name,+ base_path: Discourse.base_path,+ ),+ )+ Rails.logger.warn(+ "Disabled github_badges_enabled site setting due to repository Not Found error ",+ )+ when Octokit::Unauthorized+ disable_github_badges_and_inform_admin(+ title: I18n.t("github_commits_populator.errors.invalid_octokit_credentials_pm_title"),+ raw:+ I18n.t(+ "github_commits_populator.errors.invalid_octokit_credentials_pm",+ base_path: Discourse.base_path,+ ),+ )+ Rails.logger.warn(+ "Disabled github_badges_enabled site setting due to invalid GitHub authentication credentials via github_linkback_access_token.",+ )+ else+ Rails.logger.warn("#{err.class}: #{err.message}")+ end+ rescue Octokit::InvalidRepository => err+ disable_github_badges_and_inform_admin(+ title: I18n.t("github_commits_populator.errors.repository_identifier_invalid_pm_title"),+ raw:+ I18n.t(+ "github_commits_populator.errors.repository_identifier_invalid_pm",+ repo_name: @repo.name,+ base_path: Discourse.base_path,+ ),+ )+ Rails.logger.warn(+ "Disabled github_badges_enabled site setting due to invalid repository identifier",+ )+ end++ private++ def is_contribution?(commit)+ pr = commit.associatedPullRequests.nodes.first+ pr && pr.author && pr.mergedBy && pr.author.login != pr.mergedBy.login+ end++ def fetch_new_commits!(stop_at)+ paginator = PaginatedCommits.new(@client, @repo, page_size: 10)+ batch = paginator.commits+ done = false+ commits = []+ recent_commits =+ stop_at.present? ? [] : @repo.commits.order("committed_at DESC").first(100).pluck(:sha)+ while !done+ batch.each do |c|+ if c.oid == stop_at || recent_commits.include?(c.oid)+ done = true+ break+ end+ commits << c+ end+ break if done+ paginator = paginator.next+ batch = paginator&.commits || []+ break if batch.empty?+ end+ return if commits.size == 0+ existing_shas = @repo.commits.pluck(:sha)+ commits.reject! { |c| existing_shas.include?(c.oid) }+ batch_to_db(commits)+ set_front_commit(commits.first.oid)+ end++ # detect if a force push happened and commit is lost+ def removed?(sha)+ commit = @client.commit(@repo.name, sha)+ return true if commit.commit.nil?+ found =+ @client.commits(@repo.name, until: commit.commit.committer.date, page: 1, per_page: 1).first+ commit.sha != found.sha+ end++ def build_history!(cursor: nil)+ paginator = PaginatedCommits.new(@client, @repo, cursor: cursor, page_size: 100)+ batch = paginator.commits+ return if batch.empty?+ set_front_commit(batch.first.oid) if cursor.blank?++ while batch.size > 0+ batch_to_db(batch)+ next_cursor = paginator.next_cursor+ set_back_cursor(next_cursor) if next_cursor++ paginator = paginator.next+ batch = paginator&.commits || []+ end+ set_back_cursor(HISTORY_COMPLETE)+ end++ def batch_to_db(batch)+ fragments = []+ batch.each do |c|+ hash = commit_to_hash(c)+ fragments << DB.sql_fragment(<<~SQL, hash)+ (:repo_id, :sha, :email, :committed_at, :role_id, :merge_commit, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)+ SQL+ end+ DB.exec(<<~SQL)+ INSERT INTO github_commits+ (repo_id, sha, email, committed_at, role_id, merge_commit, created_at, updated_at) VALUES #{fragments.join(",")}+ SQL+ end++ def commit_to_hash(commit)+ {+ sha: commit.oid,+ email: commit.author.email,+ repo_id: @repo.id,+ committed_at: commit.committedDate,+ merge_commit: commit.message.match?(MERGE_COMMIT_REGEX),+ role_id: is_contribution?(commit) ? ROLES[:contributor] : ROLES[:committer],+ }+ end++ def set_front_commit(sha)+ Discourse.redis.set(front_commit_redis_key, sha)+ end++ def set_back_cursor(cursor)+ Discourse.redis.set(back_cursor_redis_key, cursor)+ end++ def front_commit_redis_key+ # this key should refer to the MOST RECENT commit we have in the db+ "discourse-github-front-commit-#{@repo.name}"+ end++ def back_cursor_redis_key+ # this key should refer to the cursor that lets us continue+ # building history from the point we reached in the previous run+ # that couldn't continue for whatever reasons+ # e.g., if we got rate-limited by github+ "discourse-github-back-cursor-#{@repo.name}"+ end++ def disable_github_badges_and_inform_admin(title:, raw:)+ SiteSetting.github_badges_enabled = false+ site_admin_usernames =+ User.where(admin: true).human_users.order("last_seen_at DESC").limit(10).pluck(:username)+ PostCreator.create!(+ Discourse.system_user,+ title: title,+ raw: raw,+ archetype: Archetype.private_message,+ target_usernames: site_admin_usernames,+ skip_validations: true,+ )+ end+ end+enddiff --git a/plugins/discourse-github/app/lib/github_badges.rb b/plugins/discourse-github/app/lib/github_badges.rbnew file mode 100644index 00000000000..73d90ab953f--- /dev/null+++ b/plugins/discourse-github/app/lib/github_badges.rb@@ -0,0 +1,178 @@+# frozen_string_literal: true++module DiscourseGithubPlugin+ module GithubBadges+ BADGE_NAME_BRONZE = "Contributor"+ BADGE_NAME_SILVER = "Great Contributor"+ BADGE_NAME_GOLD = "Amazing Contributor"++ COMMITTER_BADGE_NAME_BRONZE = "Committer"+ COMMITTER_BADGE_NAME_SILVER = "Frequent Committer"+ COMMITTER_BADGE_NAME_GOLD = "Amazing Committer"++ class Granter+ def initialize(emails)+ @emails = emails+ @badges = []+ end++ def add_badge(badge, as_title:, threshold:)+ @badges << [badge, as_title, threshold]+ end++ def grant!+ email_commits = @emails.group_by { |e| e }.map { |k, l| [k, l.count] }.to_h++ regular_emails = []+ github_name_email = {}+ @emails.each do |email|+ match = email.match(/\A(\d+\+)?(?<name>.+)@users.noreply.github.com\Z/)++ if match+ name = match[:name]+ github_name_email[name] = email+ else+ regular_emails << email+ end+ end++ user_emails = {}+ User+ .real+ .where(staged: false)+ .with_email(regular_emails)+ .each { |user| user_emails[user] = user.emails }++ if github_name_email.any?+ screen_names =+ UserAssociatedAccount+ .where(provider_name: "github")+ .where("info ->> 'nickname' IN (?)", github_name_email.keys)+ .includes(:user)+ .map { |row| [row.user, row.info["nickname"]] }+ .to_h++ screen_names.each do |user, screen_name|+ user_emails[user] ||= []+ user_emails[user] << github_name_email[screen_name]+ end+ end++ user_emails.each do |user, emails|+ commits_count = emails.sum { |email| email_commits[email] || 0 }+ @badges.each do |badge, as_title, threshold|+ if commits_count >= threshold && badge.enabled? && SiteSetting.enable_badges+ BadgeGranter.grant(badge, user)+ user.update!(title: badge.name) if badge.allow_title? && user.title.blank? && as_title+ end+ end+ end+ end+ end++ def self.grant!+ grant_committer_badges!+ grant_contributor_badges!+ end++ def self.grant_committer_badges!+ emails =+ GithubCommit.where(merge_commit: false, role_id: CommitsPopulator::ROLES[:committer]).pluck(+ :email,+ )++ bronze, silver, gold = committer_badges++ granter = GithubBadges::Granter.new(emails)+ granter.add_badge(bronze, as_title: false, threshold: 1)+ granter.add_badge(silver, as_title: true, threshold: 25)+ granter.add_badge(gold, as_title: true, threshold: 1000)+ granter.grant!+ end++ def self.grant_contributor_badges!+ emails =+ GithubCommit.where(+ merge_commit: false,+ role_id: CommitsPopulator::ROLES[:contributor],+ ).pluck(:email)++ bronze, silver, gold = contributor_badges++ granter = GithubBadges::Granter.new(emails)+ granter.add_badge(bronze, as_title: false, threshold: 1)+ granter.add_badge(+ silver,+ as_title: true,+ threshold: SiteSetting.github_silver_badge_min_commits,+ )+ granter.add_badge(gold, as_title: true, threshold: SiteSetting.github_gold_badge_min_commits)+ granter.grant!+ end++ def self.ensure_badge(name, attrs)+ badge = Badge.find_by("name ILIKE ?", name)++ # Check for letter-case differences+ badge.update!(name: name) if badge && badge.name != name++ badge || Badge.create!(name: name, **attrs)+ end++ def self.contributor_badges+ bronze =+ ensure_badge(+ BADGE_NAME_BRONZE,+ description: "Contributed an accepted pull request",+ badge_type_id: 3,+ default_icon: "fab-git-alt",+ )++ silver =+ ensure_badge(+ BADGE_NAME_SILVER,+ description: "Contributed 25 accepted pull requests",+ badge_type_id: 2,+ default_icon: "fab-git-alt",+ )++ gold =+ ensure_badge(+ BADGE_NAME_GOLD,+ description: "Contributed 250 accepted pull requests",+ badge_type_id: 1,+ default_icon: "fab-git-alt",+ )++ [bronze, silver, gold]+ end++ def self.committer_badges+ bronze =+ ensure_badge(+ COMMITTER_BADGE_NAME_BRONZE,+ description: "Created a commit",+ enabled: false,+ badge_type_id: 3,+ )++ silver =+ ensure_badge(+ COMMITTER_BADGE_NAME_SILVER,+ description: "Created 25 commits",+ enabled: false,+ badge_type_id: 2,+ )++ gold =+ ensure_badge(+ COMMITTER_BADGE_NAME_GOLD,+ description: "Created 1000 commits",+ enabled: false,+ badge_type_id: 1,+ )++ [bronze, silver, gold]+ end+ end+enddiff --git a/plugins/discourse-github/app/lib/github_badges_repo_setting_validator.rb b/plugins/discourse-github/app/lib/github_badges_repo_setting_validator.rbnew file mode 100644index 00000000000..3f479638983--- /dev/null+++ b/plugins/discourse-github/app/lib/github_badges_repo_setting_validator.rb@@ -0,0 +1,21 @@+# frozen_string_literal: true++class GithubBadgesRepoSettingValidator+ def initialize(opts = {})+ @opts = opts+ end++ def valid_value?(val)+ return true if val.blank?+ val+ .split("|")+ .all? do |repo|+ repo.match?(DiscourseGithubPlugin::GithubRepo::VALID_URL_BASED_REPO_REGEX) ||+ repo.match?(DiscourseGithubPlugin::GithubRepo::VALID_USER_BASED_REPO_REGEX)+ end+ end++ def error_message+ I18n.t("site_settings.errors.invalid_badge_repo")+ end+enddiff --git a/plugins/discourse-github/app/lib/github_linkback.rb b/plugins/discourse-github/app/lib/github_linkback.rbnew file mode 100644index 00000000000..6af5ccaed46--- /dev/null+++ b/plugins/discourse-github/app/lib/github_linkback.rb@@ -0,0 +1,162 @@+# frozen_string_literal: true++require_dependency "pretty_text"+require "digest/sha1"++class GithubLinkback+ class Link+ attr_reader :url, :project, :type+ attr_accessor :sha, :pr_number, :issue_number++ def initialize(url, project, type)+ @url = url+ @project = project+ @type = type+ end+ end++ def initialize(post)+ @post = post+ end++ def should_enqueue?+ !!(+ SiteSetting.github_linkback_enabled? && SiteSetting.enable_discourse_github_plugin? &&+ @post.present? && @post.post_type == Post.types[:regular] && @post.raw =~ /github\.com/ &&+ Guardian.new.can_see?(@post) && @post.topic.visible?+ )+ end++ def enqueue+ 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|+ if l =~ %r{https?://github\.com/([^/]+)/([^/]+)/commit/([0-9a-f]+)}+ url, org, repo, sha = Regexp.last_match.to_a+ project = "#{org}/#{repo}"++ next if result[url]+ next if @post.custom_fields[GithubLinkback.field_for(url)].present?+ next unless is_allowed_project_link?(projects, project)++ link = Link.new(url, project, :commit)+ link.sha = sha+ result[url] = link+ elsif l =~ %r{https?://github.com/([^/]+)/([^/]+)/pull/(\d+)}+ url, org, repo, pr_number = Regexp.last_match.to_a+ project = "#{org}/#{repo}"++ next if result[url]+ next if @post.custom_fields[GithubLinkback.field_for(url)].present?+ next unless is_allowed_project_link?(projects, project)++ link = Link.new(url, project, :pr)+ link.pr_number = pr_number.to_i+ result[url] = link+ elsif l =~ %r{https?://github.com/([^/]+)/([^/]+)/issues/(\d+)}+ url, org, repo, issue_number = Regexp.last_match.to_a+ project = "#{org}/#{repo}"++ next if result[url]+ next if @post.custom_fields[GithubLinkback.field_for(url)].present?+ next unless is_allowed_project_link?(projects, project)++ link = Link.new(url, project, :issue)+ link.issue_number = issue_number.to_i+ result[url] = link+ end+ end+ result.values+ end++ def is_allowed_project_link?(projects, project)+ return true if projects.include?(project)++ check_user = project.split("/")[0]+ projects.any? do |allowed_project|+ allowed_user, allowed_all_projects = allowed_project.split("/")+ (allowed_user == check_user) && (allowed_all_projects == "*")+ end+ end++ def create+ return [] if SiteSetting.github_linkback_access_token.blank?++ links = []++ DistributedMutex.synchronize("github_linkback_#{@post.id}") do+ links = github_links+ return [] if links.length() > SiteSetting.github_linkback_maximum_links++ links.each do |link|+ case link.type+ when :commit+ post_commit(link)+ when :pr+ post_pr_or_issue(link, :pr)+ when :issue+ post_pr_or_issue(link, :issue)+ else+ next+ end++ # Don't post the same link twice+ @post.custom_fields[GithubLinkback.field_for(link.url)] = "true"+ end+ @post.save_custom_fields+ end++ links+ end++ def self.field_for(url)+ "github-linkback:#{Digest::SHA1.hexdigest(url)[0..15]}"+ end++ private++ def post_pr_or_issue(link, type)+ pr_or_issue_number = link.pr_number || link.issue_number+ github_url =+ "https://api.github.com/repos/#{link.project}/issues/#{pr_or_issue_number}/comments"+ comment =+ I18n.t(+ type == :pr ? "github_linkback.pr_template" : "github_linkback.issue_template",+ title: SiteSetting.title,+ post_url: "#{Discourse.base_url}#{@post.url}",+ )++ Excon.post(github_url, body: { body: comment }.to_json, headers: headers)+ end++ def post_commit(link)+ github_url = "https://api.github.com/repos/#{link.project}/commits/#{link.sha}/comments"++ comment =+ I18n.t(+ "github_linkback.commit_template",+ title: SiteSetting.title,+ post_url: "#{Discourse.base_url}#{@post.url}",+ )++ Excon.post(github_url, body: { body: comment }.to_json, headers: headers)+ end++ def headers+ {+ "Content-Type" => "application/json",+ "Authorization" => "token #{SiteSetting.github_linkback_access_token}",+ "User-Agent" => "Discourse-Github-Linkback",+ }+ end+enddiff --git a/plugins/discourse-github/app/lib/github_linkback_access_token_setting_validator.rb b/plugins/discourse-github/app/lib/github_linkback_access_token_setting_validator.rbnew file mode 100644index 00000000000..44834dd2164--- /dev/null+++ b/plugins/discourse-github/app/lib/github_linkback_access_token_setting_validator.rb@@ -0,0 +1,20 @@+# frozen_string_literal: true++class GithubLinkbackAccessTokenSettingValidator+ def initialize(opts = {})+ @opts = opts+ end++ def valid_value?(val)+ return true if val.blank?+ client = Octokit::Client.new(access_token: val, per_page: 1)+ DiscourseGithubPlugin::GithubRepo.repos.each { |repo| client.branches(repo.name) }+ true+ rescue Octokit::Unauthorized+ false+ end++ def error_message+ I18n.t("site_settings.errors.invalid_github_linkback_access_token")+ end+enddiff --git a/plugins/discourse-github/app/lib/github_permalinks.rb b/plugins/discourse-github/app/lib/github_permalinks.rbnew file mode 100644index 00000000000..5d9bcf3d9a4--- /dev/null+++ b/plugins/discourse-github/app/lib/github_permalinks.rb@@ -0,0 +1,25 @@+# frozen_string_literal: true++module ::GithubPermalinks+ def self.replace_github_non_permalinks(post)+ # replaces github non-permalinks with permalinks containing a specific commit id+ regex = %r{https?://github\.com/[^/]+/[^/\s]+/blob/[^\s]+}i++ # don't replace urls in posts that are more than 1h old+ return if ((Time.zone.now - post.created_at) / 60).round > 60++ # only run the job when post is changed by a user and it contains a github url+ return if (post.last_editor_id && post.last_editor_id <= 0) || !post.raw.match(regex)++ # make sure no other job is scheduled+ Jobs.cancel_scheduled_job(:replace_github_non_permalinks, post_id: post.id)++ # schedule the job+ Jobs.enqueue_in(+ (SiteSetting.editing_grace_period + 1).seconds.to_i,+ :replace_github_non_permalinks,+ post_id: post.id,+ bypass_bump: false,+ )+ end+enddiff --git a/plugins/discourse-github/app/models/github_commit.rb b/plugins/discourse-github/app/models/github_commit.rbnew file mode 100644index 00000000000..42e15079dd8--- /dev/null+++ b/plugins/discourse-github/app/models/github_commit.rb@@ -0,0 +1,26 @@+# frozen_string_literal: true++module DiscourseGithubPlugin+ class GithubCommit < ActiveRecord::Base+ belongs_to :repo, class_name: :GithubRepo+ end+end++# == Schema Information+#+# Table name: github_commits+#+# id :bigint not null, primary key+# repo_id :bigint not null+# sha :string(40) not null+# email :string(513) not null+# committed_at :datetime not null+# role_id :integer not null+# merge_commit :boolean default(FALSE), not null+# created_at :datetime not null+# updated_at :datetime not null+#+# Indexes+#+# index_github_commits_on_repo_id (repo_id)+#diff --git a/plugins/discourse-github/app/models/github_repo.rb b/plugins/discourse-github/app/models/github_repo.rbnew file mode 100644index 00000000000..d16804188fa--- /dev/null+++ b/plugins/discourse-github/app/models/github_repo.rb@@ -0,0 +1,48 @@+# frozen_string_literal: true++module DiscourseGithubPlugin+ class GithubRepo < ActiveRecord::Base+ VALID_URL_BASED_REPO_REGEX = %r{https?://github.com/(.+)}+ VALID_USER_BASED_REPO_REGEX = Octokit::Repository::NAME_WITH_OWNER_PATTERN++ has_many :commits, foreign_key: :repo_id, class_name: :GithubCommit, dependent: :destroy++ def self.repos+ repos = []+ SiteSetting+ .github_badges_repos+ .split("|")+ .each do |link|+ name = match_name_from_setting(link)+ next if name.blank?+ name.gsub!(/\.git$/, "")+ name.gsub!(%r{/$}, "") # Remove trailing '/'+ repos << find_or_create_by!(name: name)+ end+ repos+ end++ def self.match_name_from_setting(repo)+ if repo =~ VALID_URL_BASED_REPO_REGEX+ Regexp.last_match[1]+ elsif repo =~ VALID_USER_BASED_REPO_REGEX+ repo_name = Regexp.last_match[0]+ repo.match(/https?:/).blank? ? repo_name : nil+ end+ end+ end+end++# == Schema Information+#+# Table name: github_repos+#+# id :bigint not null, primary key+# name :string(255) not null+# created_at :datetime not null+# updated_at :datetime not null+#+# Indexes+#+# index_github_repos_on_name (name) UNIQUE+#diff --git a/plugins/discourse-github/config/locales/client.ar.yml b/plugins/discourse-github/config/locales/client.ar.ymlnew file mode 100644index 00000000000..f60ed2807c0--- /dev/null+++ b/plugins/discourse-github/config/locales/client.ar.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ar:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "تم استبدال رابط Github برابط دائم"diff --git a/plugins/discourse-github/config/locales/client.be.yml b/plugins/discourse-github/config/locales/client.be.ymlnew file mode 100644index 00000000000..2ea77a0d350--- /dev/null+++ b/plugins/discourse-github/config/locales/client.be.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++be:diff --git a/plugins/discourse-github/config/locales/client.bg.yml b/plugins/discourse-github/config/locales/client.bg.ymlnew file mode 100644index 00000000000..52333529d3c--- /dev/null+++ b/plugins/discourse-github/config/locales/client.bg.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++bg:diff --git a/plugins/discourse-github/config/locales/client.bs_BA.yml b/plugins/discourse-github/config/locales/client.bs_BA.ymlnew file mode 100644index 00000000000..828a7e65af8--- /dev/null+++ b/plugins/discourse-github/config/locales/client.bs_BA.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++bs_BA:diff --git a/plugins/discourse-github/config/locales/client.ca.yml b/plugins/discourse-github/config/locales/client.ca.ymlnew file mode 100644index 00000000000..ec737bc1a5b--- /dev/null+++ b/plugins/discourse-github/config/locales/client.ca.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ca:diff --git a/plugins/discourse-github/config/locales/client.cs.yml b/plugins/discourse-github/config/locales/client.cs.ymlnew file mode 100644index 00000000000..e009c5bbfb0--- /dev/null+++ b/plugins/discourse-github/config/locales/client.cs.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++cs:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "Odkaz na Github byl nahrazen trvalým odkazem"diff --git a/plugins/discourse-github/config/locales/client.da.yml b/plugins/discourse-github/config/locales/client.da.ymlnew file mode 100644index 00000000000..f39c727c594--- /dev/null+++ b/plugins/discourse-github/config/locales/client.da.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++da:diff --git a/plugins/discourse-github/config/locales/client.de.yml b/plugins/discourse-github/config/locales/client.de.ymlnew file mode 100644index 00000000000..cdd83afddc7--- /dev/null+++ b/plugins/discourse-github/config/locales/client.de.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++de:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse – GitHub"+ replace_github_link:+ edit_reason: "Github-Link wurde durch einen permanenten Link ersetzt"diff --git a/plugins/discourse-github/config/locales/client.el.yml b/plugins/discourse-github/config/locales/client.el.ymlnew file mode 100644index 00000000000..d872d0ecc40--- /dev/null+++ b/plugins/discourse-github/config/locales/client.el.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++el:diff --git a/plugins/discourse-github/config/locales/client.en.yml b/plugins/discourse-github/config/locales/client.en.ymlnew file mode 100644index 00000000000..c3815f45d86--- /dev/null+++ b/plugins/discourse-github/config/locales/client.en.yml@@ -0,0 +1,8 @@+en:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "Github link was replaced with a permanent link"diff --git a/plugins/discourse-github/config/locales/client.en_GB.yml b/plugins/discourse-github/config/locales/client.en_GB.ymlnew file mode 100644index 00000000000..2d4fa180ec7--- /dev/null+++ b/plugins/discourse-github/config/locales/client.en_GB.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++en_GB:diff --git a/plugins/discourse-github/config/locales/client.es.yml b/plugins/discourse-github/config/locales/client.es.ymlnew file mode 100644index 00000000000..921a57b370e--- /dev/null+++ b/plugins/discourse-github/config/locales/client.es.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++es:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "GitHub de Discourse"+ replace_github_link:+ edit_reason: "El enlace de Github ha sido sustituido por un enlace permanente"diff --git a/plugins/discourse-github/config/locales/client.et.yml b/plugins/discourse-github/config/locales/client.et.ymlnew file mode 100644index 00000000000..0ea0b6d554b--- /dev/null+++ b/plugins/discourse-github/config/locales/client.et.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++et:diff --git a/plugins/discourse-github/config/locales/client.fa_IR.yml b/plugins/discourse-github/config/locales/client.fa_IR.ymlnew file mode 100644index 00000000000..f7a1dda1d82--- /dev/null+++ b/plugins/discourse-github/config/locales/client.fa_IR.yml@@ -0,0 +1,9 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++fa_IR:+ replace_github_link:+ edit_reason: "پیوند گیتهاب با یک پیوند دائمی جایگزین شد"diff --git a/plugins/discourse-github/config/locales/client.fi.yml b/plugins/discourse-github/config/locales/client.fi.ymlnew file mode 100644index 00000000000..6d65673af12--- /dev/null+++ b/plugins/discourse-github/config/locales/client.fi.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++fi:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "Github-linkki korvattiin pysyvällä linkillä"diff --git a/plugins/discourse-github/config/locales/client.fr.yml b/plugins/discourse-github/config/locales/client.fr.ymlnew file mode 100644index 00000000000..62bd92eeb57--- /dev/null+++ b/plugins/discourse-github/config/locales/client.fr.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++fr:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "Le lien Github a été remplacé par un lien permanent"diff --git a/plugins/discourse-github/config/locales/client.gl.yml b/plugins/discourse-github/config/locales/client.gl.ymlnew file mode 100644index 00000000000..fb911ce1635--- /dev/null+++ b/plugins/discourse-github/config/locales/client.gl.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++gl:diff --git a/plugins/discourse-github/config/locales/client.he.yml b/plugins/discourse-github/config/locales/client.he.ymlnew file mode 100644index 00000000000..83f9979c359--- /dev/null+++ b/plugins/discourse-github/config/locales/client.he.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++he:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "הקישור ל־GitHub הוחלף בקישור קבוע"diff --git a/plugins/discourse-github/config/locales/client.hr.yml b/plugins/discourse-github/config/locales/client.hr.ymlnew file mode 100644index 00000000000..93343ce6e19--- /dev/null+++ b/plugins/discourse-github/config/locales/client.hr.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++hr:diff --git a/plugins/discourse-github/config/locales/client.hu.yml b/plugins/discourse-github/config/locales/client.hu.ymlnew file mode 100644index 00000000000..76b6e9d8bcb--- /dev/null+++ b/plugins/discourse-github/config/locales/client.hu.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++hu:diff --git a/plugins/discourse-github/config/locales/client.hy.yml b/plugins/discourse-github/config/locales/client.hy.ymlnew file mode 100644index 00000000000..cb18f64d356--- /dev/null+++ b/plugins/discourse-github/config/locales/client.hy.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++hy:diff --git a/plugins/discourse-github/config/locales/client.id.yml b/plugins/discourse-github/config/locales/client.id.ymlnew file mode 100644index 00000000000..596e36b2e13--- /dev/null+++ b/plugins/discourse-github/config/locales/client.id.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++id:diff --git a/plugins/discourse-github/config/locales/client.it.yml b/plugins/discourse-github/config/locales/client.it.ymlnew file mode 100644index 00000000000..502c03aaa89--- /dev/null+++ b/plugins/discourse-github/config/locales/client.it.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++it:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "Il collegamento Github è stato sostituito con un collegamento permanente"diff --git a/plugins/discourse-github/config/locales/client.ja.yml b/plugins/discourse-github/config/locales/client.ja.ymlnew file mode 100644index 00000000000..bf000588b0a--- /dev/null+++ b/plugins/discourse-github/config/locales/client.ja.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ja:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "GitHub リンクはパーマリンクに置き換えられました"diff --git a/plugins/discourse-github/config/locales/client.ko.yml b/plugins/discourse-github/config/locales/client.ko.ymlnew file mode 100644index 00000000000..18dd77fd3ec--- /dev/null+++ b/plugins/discourse-github/config/locales/client.ko.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ko:diff --git a/plugins/discourse-github/config/locales/client.lt.yml b/plugins/discourse-github/config/locales/client.lt.ymlnew file mode 100644index 00000000000..16bb19758dc--- /dev/null+++ b/plugins/discourse-github/config/locales/client.lt.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++lt:diff --git a/plugins/discourse-github/config/locales/client.lv.yml b/plugins/discourse-github/config/locales/client.lv.ymlnew file mode 100644index 00000000000..59e0ef6f4ed--- /dev/null+++ b/plugins/discourse-github/config/locales/client.lv.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++lv:diff --git a/plugins/discourse-github/config/locales/client.nb_NO.yml b/plugins/discourse-github/config/locales/client.nb_NO.ymlnew file mode 100644index 00000000000..2e2224d1472--- /dev/null+++ b/plugins/discourse-github/config/locales/client.nb_NO.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++nb_NO:diff --git a/plugins/discourse-github/config/locales/client.nl.yml b/plugins/discourse-github/config/locales/client.nl.ymlnew file mode 100644index 00000000000..e2a5ddc0c9e--- /dev/null+++ b/plugins/discourse-github/config/locales/client.nl.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++nl:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "Github-link is vervangen door een permanente link"diff --git a/plugins/discourse-github/config/locales/client.pl_PL.yml b/plugins/discourse-github/config/locales/client.pl_PL.ymlnew file mode 100644index 00000000000..7f5d18eed24--- /dev/null+++ b/plugins/discourse-github/config/locales/client.pl_PL.yml@@ -0,0 +1,9 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++pl_PL:+ replace_github_link:+ edit_reason: "Link do Githuba został zastąpiony stałym linkiem"diff --git a/plugins/discourse-github/config/locales/client.pt.yml b/plugins/discourse-github/config/locales/client.pt.ymlnew file mode 100644index 00000000000..298ba523c1d--- /dev/null+++ b/plugins/discourse-github/config/locales/client.pt.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++pt:diff --git a/plugins/discourse-github/config/locales/client.pt_BR.yml b/plugins/discourse-github/config/locales/client.pt_BR.ymlnew file mode 100644index 00000000000..2624bf646bf--- /dev/null+++ b/plugins/discourse-github/config/locales/client.pt_BR.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++pt_BR:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "O link do Github foi subtituído por um link permanente"diff --git a/plugins/discourse-github/config/locales/client.ro.yml b/plugins/discourse-github/config/locales/client.ro.ymlnew file mode 100644index 00000000000..08a77f812ee--- /dev/null+++ b/plugins/discourse-github/config/locales/client.ro.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ro:diff --git a/plugins/discourse-github/config/locales/client.ru.yml b/plugins/discourse-github/config/locales/client.ru.ymlnew file mode 100644index 00000000000..ed32c822ef2--- /dev/null+++ b/plugins/discourse-github/config/locales/client.ru.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ru:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Плагин GitHub для Discourse"+ replace_github_link:+ edit_reason: "Ссылка на Github была заменена на постоянную ссылку"diff --git a/plugins/discourse-github/config/locales/client.sk.yml b/plugins/discourse-github/config/locales/client.sk.ymlnew file mode 100644index 00000000000..6f815624081--- /dev/null+++ b/plugins/discourse-github/config/locales/client.sk.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sk:diff --git a/plugins/discourse-github/config/locales/client.sl.yml b/plugins/discourse-github/config/locales/client.sl.ymlnew file mode 100644index 00000000000..23489a48b1f--- /dev/null+++ b/plugins/discourse-github/config/locales/client.sl.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sl:diff --git a/plugins/discourse-github/config/locales/client.sq.yml b/plugins/discourse-github/config/locales/client.sq.ymlnew file mode 100644index 00000000000..7f051b7a7cf--- /dev/null+++ b/plugins/discourse-github/config/locales/client.sq.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sq:diff --git a/plugins/discourse-github/config/locales/client.sr.yml b/plugins/discourse-github/config/locales/client.sr.ymlnew file mode 100644index 00000000000..88d63d6ae1a--- /dev/null+++ b/plugins/discourse-github/config/locales/client.sr.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sr:diff --git a/plugins/discourse-github/config/locales/client.sv.yml b/plugins/discourse-github/config/locales/client.sv.ymlnew file mode 100644index 00000000000..0a062a2f588--- /dev/null+++ b/plugins/discourse-github/config/locales/client.sv.yml@@ -0,0 +1,9 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sv:+ replace_github_link:+ edit_reason: "Github-länken ersattes med en permanent länk"diff --git a/plugins/discourse-github/config/locales/client.sw.yml b/plugins/discourse-github/config/locales/client.sw.ymlnew file mode 100644index 00000000000..0d7cdd075bf--- /dev/null+++ b/plugins/discourse-github/config/locales/client.sw.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sw:diff --git a/plugins/discourse-github/config/locales/client.te.yml b/plugins/discourse-github/config/locales/client.te.ymlnew file mode 100644index 00000000000..03967bdbb07--- /dev/null+++ b/plugins/discourse-github/config/locales/client.te.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++te:diff --git a/plugins/discourse-github/config/locales/client.th.yml b/plugins/discourse-github/config/locales/client.th.ymlnew file mode 100644index 00000000000..7de85ff91c4--- /dev/null+++ b/plugins/discourse-github/config/locales/client.th.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++th:diff --git a/plugins/discourse-github/config/locales/client.tr_TR.yml b/plugins/discourse-github/config/locales/client.tr_TR.ymlnew file mode 100644index 00000000000..6ac8c215cd6--- /dev/null+++ b/plugins/discourse-github/config/locales/client.tr_TR.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++tr_TR:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "Github bağlantısı kalıcı bir bağlantıyla değiştirildi"diff --git a/plugins/discourse-github/config/locales/client.ug.yml b/plugins/discourse-github/config/locales/client.ug.ymlnew file mode 100644index 00000000000..a6bf0185ae2--- /dev/null+++ b/plugins/discourse-github/config/locales/client.ug.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ug:diff --git a/plugins/discourse-github/config/locales/client.uk.yml b/plugins/discourse-github/config/locales/client.uk.ymlnew file mode 100644index 00000000000..f1390545d1d--- /dev/null+++ b/plugins/discourse-github/config/locales/client.uk.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++uk:diff --git a/plugins/discourse-github/config/locales/client.ur.yml b/plugins/discourse-github/config/locales/client.ur.ymlnew file mode 100644index 00000000000..b4a9c21ee2f--- /dev/null+++ b/plugins/discourse-github/config/locales/client.ur.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ur:diff --git a/plugins/discourse-github/config/locales/client.vi.yml b/plugins/discourse-github/config/locales/client.vi.ymlnew file mode 100644index 00000000000..f629dcf5329--- /dev/null+++ b/plugins/discourse-github/config/locales/client.vi.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++vi:diff --git a/plugins/discourse-github/config/locales/client.zh_CN.yml b/plugins/discourse-github/config/locales/client.zh_CN.ymlnew file mode 100644index 00000000000..2d839a6d5d5--- /dev/null+++ b/plugins/discourse-github/config/locales/client.zh_CN.yml@@ -0,0 +1,14 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++zh_CN:+ admin_js:+ admin:+ site_settings:+ categories:+ discourse_github: "Discourse GitHub"+ replace_github_link:+ edit_reason: "Github 链接被替换为永久链接"diff --git a/plugins/discourse-github/config/locales/client.zh_TW.yml b/plugins/discourse-github/config/locales/client.zh_TW.ymlnew file mode 100644index 00000000000..7e15fab0018--- /dev/null+++ b/plugins/discourse-github/config/locales/client.zh_TW.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++zh_TW:diff --git a/plugins/discourse-github/config/locales/server.ar.yml b/plugins/discourse-github/config/locales/server.ar.ymlnew file mode 100644index 00000000000..9f1f3de71f5--- /dev/null+++ b/plugins/discourse-github/config/locales/server.ar.yml@@ -0,0 +1,63 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ar:+ site_settings:+ enable_discourse_github_plugin: "تفعيل المكوِّن الإضافي discourse-github"+ github_linkback_enabled: "ربط مشكلات GitHub بمناقشات المنتدى"+ github_linkback_projects: "قائمة المشروعات التي يمكن الربط بها"+ github_linkback_access_token: 'رمز وصول صالح للمستخدم الذي سينشر الرابط ولإحصاء الإرسالات/المساهمات لمنح الشارات. راجع <a href="https://meta.discourse.org/t/99895">هنا</a> للحصول على الإرشادات بشأن كيفية الحصول على رمز مميَّز.'+ github_linkback_maximum_links: "الحد الأقصى لعدد الروابط التي يمكن إنشاؤها من منشور واحد. عندما تحتوي إحدى المشاركات على روابط أكثر من الحد، لا يتم إنشاء أيٍّ منها."+ github_permalinks_enabled: "تفعيل استبدال الرابط الثابت من GitHub"+ github_permalinks_exclude: "اسم الملف أو الدليل الذي يجب استبعاده من استبدال الرابط الثابت. أدخل اسم الملف أو المسار الكامل فقط: user/repository/optional-directory/filename"+ github_badges_enabled: "تفعيل شارات GitHub"+ github_badges_repos: "عناوين URL الخاصة بمستودعات GitHub للبحث عن المساهمات والإرسالات"+ github_silver_badge_min_commits: "أقل عدد من الإرسالات للحصول على الشارة الفضية"+ github_gold_badge_min_commits: "أقل عدد من الإرسالات للحصول على الشارة الذهبية"+ errors:+ invalid_badge_repo: "يجب عليك إدخال عنوان URL على GitHub أو اسم المستودع بالتنسيق github_user/repository_name"+ invalid_github_linkback_access_token: "يجب عليك إدخال رمز وصول صالح إلى رابط GitHub والذي يمكنه الوصول إلى مستودعات الشارة التي أدخلتها."+ github_linkback:+ commit_template: |+ تم ذكر هذا الإرسال في **%{title}**. قد تكون هناك تفاصيل ذات صلة هناك:++ %{post_url}+ pr_template: |+ تم ذكر طلب السحب هذا في **%{title}**. قد تكون هناك تفاصيل ذات صلة هناك:++ %{post_url}+ issue_template: |+ تم ذكر هذه المشكلة في **%{title}**. قد تكون هناك تفاصيل ذات صلة هناك:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "الإجراء المطلوب للمكوِّن الإضافي discourse-github"+ repository_identifier_invalid_pm: |+ المستودع المحدَّد في المكوِّن الإضافي discourse-github غير صالح:+ %{repo_name}++ يجب تحديده في صورة `user/repo`.++ لن يتم منح الشارات حتى يتم تصحيح الاسم في+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">إعدادات الموقع لـ discourse-github</a>+ وإعادة تشغيل "github_badges_enabled".+ repository_not_found_pm_title: "الإجراء المطلوب للمكوِّن الإضافي discourse-github"+ repository_not_found_pm: |+ أرجع المستودع المحدَّد في المكوِّن الإضافي discourse-github رسالة الخطأ "غير موجود":+ %{repo_name}++ يجب تحديده في صورة `user/repo`.++ لن يتم منح الشارات حتى يتم تصحيح الاسم في+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">إعدادات الموقع لـ discourse-github</a>+ وإعادة تشغيل "github_badges_enabled".+ invalid_octokit_credentials_pm_title: "الإجراء المطلوب للمكوِّن الإضافي discourse-github"+ invalid_octokit_credentials_pm: |+ بيانات اعتماد GitHub التي أدخلتها للمكوِّن الإضافي discourse-github غير صالحة. تم تعطيل إعداد الموقع "github badges enabled"، ولن يتم ملء الإرسالات بعد الآن حتى يتم حل المشكلة.++ تحقَّق من إعداد الموقع "رمز الوصول إلى رابط github" للتأكُّد من صحة الرمز المميَّز وأن لديه إذن لجميع المستودعات عبر+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">إعدادات الموقع لـ discourse-github</a>.diff --git a/plugins/discourse-github/config/locales/server.be.yml b/plugins/discourse-github/config/locales/server.be.ymlnew file mode 100644index 00000000000..2ea77a0d350--- /dev/null+++ b/plugins/discourse-github/config/locales/server.be.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++be:diff --git a/plugins/discourse-github/config/locales/server.bg.yml b/plugins/discourse-github/config/locales/server.bg.ymlnew file mode 100644index 00000000000..52333529d3c--- /dev/null+++ b/plugins/discourse-github/config/locales/server.bg.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++bg:diff --git a/plugins/discourse-github/config/locales/server.bs_BA.yml b/plugins/discourse-github/config/locales/server.bs_BA.ymlnew file mode 100644index 00000000000..828a7e65af8--- /dev/null+++ b/plugins/discourse-github/config/locales/server.bs_BA.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++bs_BA:diff --git a/plugins/discourse-github/config/locales/server.ca.yml b/plugins/discourse-github/config/locales/server.ca.ymlnew file mode 100644index 00000000000..ec737bc1a5b--- /dev/null+++ b/plugins/discourse-github/config/locales/server.ca.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ca:diff --git a/plugins/discourse-github/config/locales/server.cs.yml b/plugins/discourse-github/config/locales/server.cs.ymlnew file mode 100644index 00000000000..9b7da0ed29c--- /dev/null+++ b/plugins/discourse-github/config/locales/server.cs.yml@@ -0,0 +1,57 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++cs:+ site_settings:+ enable_discourse_github_plugin: "Povolit discourse-github plugin"+ github_linkback_enabled: "Propojit GitHub issues a diskuse na fóru"+ github_linkback_projects: "Seznam projektů, které chcete propojit"+ github_linkback_access_token: 'Platný přístupový token pro uživatele, který bude zveřejňovat zpětný odkaz a počítat commity/příspěvky pro udělování odznaků. Pokyny k získání tokenu naleznete <a href="https://meta.discourse.org/t/99895">zde</a>.'+ github_linkback_maximum_links: "Maximální počet zpětných odkazů, které lze vytvořit z jednoho příspěvku. Když příspěvek obsahuje více odkazů, žádný se nevytvoří."+ github_permalinks_enabled: "Povolení přepisování trvalých odkazů GitHubu"+ github_permalinks_exclude: "Název souboru nebo adresáře, který má být vyloučen z přepisování trvalých odkazů. Zadejte pouze název souboru nebo celou cestu: user/repository/optional-directory/filename."+ github_badges_enabled: "Povolit odznaky GitHub"+ github_badges_repos: "Adresy URL repozitářů GitHub pro vyhledávání příspěvků a commitů."+ github_silver_badge_min_commits: "Minimální počet commitů pro stříbrný odznak"+ github_gold_badge_min_commits: "Minimální počet commitů pro zlatý odznak"+ errors:+ invalid_badge_repo: "Musíte zadat adresu URL GitHubu nebo název úložiště ve formátu github_user/repository_name"+ invalid_github_linkback_access_token: "Musíte poskytnout platný přístupový token pro zpětné odkazy GitHub, který má přístup k repozitářům odznaků, které jste poskytli."+ github_linkback:+ commit_template: |+ Tento commit byl zmíněn na **%{title}**. Mohou tam být relevantní podrobnosti:++ %{post_url}+ pr_template: |+ Tento pull request byl zmíněn na **%{title}**. Možná tam existují relevantní podrobnosti:++ %{post_url}+ issue_template: |+ Tento problém byl zmíněn na **%{title}**. Tam mohou být relevantní podrobnosti:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "Pro plugin discourse-github je vyžadována akce"+ repository_identifier_invalid_pm: |+ Repozitář zadaný v pluginu discourse-github je neplatný:+ %{repo_name}++ Měl by být zadán jako `user/repo`.++ Odznaky nebudou uděleny, dokud nebude název opraven v+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">nastavení webu discourse-github</a>+ a nebude znovu zapnuto „github_badges_enabled“.+ repository_not_found_pm_title: "Pro plugin discourse-github je vyžadována akce"+ repository_not_found_pm: |+ Repozitář uvedený v pluginu discourse-github vrátil chybu "Not Found"+ : %{repo_name}++ odznaky nebudou uděleny, dokud nebude název opraven v+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">nastavení webu discourse-github</a>+ a nebude znovu zapnuto "github_badges_enabled".+ invalid_octokit_credentials_pm_title: "Pro plugin discourse-github je vyžadována akce"+ invalid_octokit_credentials_pm: "Pověření GitHub poskytnutá pluginu discourse-github jsou neplatná. Nastavení \"github badges enabled\" \nbylo deaktivováno a commity již nebudou vyplňovány, dokud nebude problém vyřešen.\n\nZkontrolujte nastavení webu „github linkback access token“, abyste se ujistili, že token je správný a má oprávnění ke všem úložištím\nprostřednictvím\n<a href=\"%{base_path}/admin/site_settings/category/plugins?filter=GitHub\">nastavení webu discourse-github</a>.\n"diff --git a/plugins/discourse-github/config/locales/server.da.yml b/plugins/discourse-github/config/locales/server.da.ymlnew file mode 100644index 00000000000..f39c727c594--- /dev/null+++ b/plugins/discourse-github/config/locales/server.da.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++da:diff --git a/plugins/discourse-github/config/locales/server.de.yml b/plugins/discourse-github/config/locales/server.de.ymlnew file mode 100644index 00000000000..5659db3b393--- /dev/null+++ b/plugins/discourse-github/config/locales/server.de.yml@@ -0,0 +1,62 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++de:+ site_settings:+ enable_discourse_github_plugin: "Aktiviere das discourse-github-Plug-in"+ github_linkback_enabled: "GitHub-Themen mit Forumsdiskussionen verlinken"+ github_linkback_projects: "Liste der Projekte, von denen zurückverlinkt werden soll"+ github_linkback_access_token: 'Ein gültiges Zugriffstoken für den Benutzer, der den Linkback veröffentlicht, und für das Zählen von Commits/Beiträgen, um Abzeichen zu vergeben. Siehe <a href="https://meta.discourse.org/t/99895">hier</a> für Anweisungen, wie du ein Token bekommst.'+ github_linkback_maximum_links: "Maximale Anzahl von Linkbacks, die aus einem einzigen Beitrag erstellt werden können. Wenn ein Beitrag mehr Links enthält, werden keine erstellt."+ github_permalinks_enabled: "Überschreiben von GitHub-Permalinks aktivieren"+ github_permalinks_exclude: "Dateiname oder Verzeichnis, der/das vom Überschreiben von Permalinks ausgeschlossen werden soll. Gib nur den Dateinamen oder den vollständigen Pfad an: user/repository/optional-directory/filename"+ github_badges_enabled: "GitHub-Abzeichen aktivieren"+ github_badges_repos: "URLs der GitHub-Repos, die nach Beiträgen und Commits durchsucht werden sollen"+ github_silver_badge_min_commits: "Mindestanzahl an Commits für das Silberabzeichen"+ github_gold_badge_min_commits: "Mindestanzahl an Commits für das Goldabzeichen"+ errors:+ invalid_badge_repo: "Du musst eine GitHub-URL oder den Repository-Namen im Format github_user/repository_name angeben"+ invalid_github_linkback_access_token: "Du musst ein gültiges GitHub-Linkback-Access-Token angeben, das Zugriff auf die von dir angegebenen Abzeichen-Repositories hat."+ github_linkback:+ commit_template: |+ Dieser Commit wurde auf **%{title}** erwähnt. Vielleicht gibt es dort relevante Details:++ %{post_url}+ pr_template: |+ Dieser PR wurde auf **%{title}** erwähnt. Vielleicht gibt es dort relevante Details:++ %{post_url}+ issue_template: |+ Dieses Thema wurde auf **%{title}** erwähnt. Vielleicht gibt es dort relevante Details:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "Aktion erforderlich für discourse-github-Plug-in"+ repository_identifier_invalid_pm: |+ Ein im discourse-github-Plug-in angegebenes Repository ist ungültig:+ %{repo_name}++ Es muss als `user/repo` angegeben werden.++ Abzeichen werden erst vergeben, nachdem der Name in den+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">Website-Einstellungen für discourse-github</a>+ korrigiert und „github_badges_enabled“ wieder aktiviert wurde.+ repository_not_found_pm_title: "Aktion erforderlich für discourse-github-Plug-in"+ repository_not_found_pm: |+ Ein im discourse-github-Plug-in angegebenes Repository wurde nicht gefunden:+ %{repo_name}++ Abzeichen werden erst vergeben, nachdem der Name in den+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">Website-Einstellungen für discourse-github</a>+ korrigiert und „github_badges_enabled“ wieder aktiviert wurde.+ invalid_octokit_credentials_pm_title: "Aktion erforderlich für discourse-github-Plug-in"+ invalid_octokit_credentials_pm: |+ Die GitHub-Anmeldedaten, die für das discourse-github-Plug-in angegeben wurden, sind ungültig. Die Website-Einstellung „github badges enabled“+ wurde deaktiviert und Commits werden nicht mehr übertragen, bis das Problem behoben ist.++ Überprüfe deine Website-Einstellung „github linkback access token“, um sicherzustellen, dass das Token korrekt ist und über Zugriffsrechte auf alle Repos verfügt. Besuche hierzu die+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">Website-Einstellungen für discourse-github</a>.diff --git a/plugins/discourse-github/config/locales/server.el.yml b/plugins/discourse-github/config/locales/server.el.ymlnew file mode 100644index 00000000000..d872d0ecc40--- /dev/null+++ b/plugins/discourse-github/config/locales/server.el.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++el:diff --git a/plugins/discourse-github/config/locales/server.en.yml b/plugins/discourse-github/config/locales/server.en.ymlnew file mode 100644index 00000000000..0f77725e283--- /dev/null+++ b/plugins/discourse-github/config/locales/server.en.yml@@ -0,0 +1,59 @@+en:+ site_settings:+ enable_discourse_github_plugin: "Enable the discourse-github plugin"+ github_linkback_enabled: "Link GitHub issues back to forum discussions"+ github_linkback_projects: "List of projects to link back from"+ github_linkback_access_token: 'A valid access token for the user who will post the linkback and for counting commits/contributions to grant badges. See <a href="https://meta.discourse.org/t/99895">here</a> for instructions on how to get a token.'+ github_linkback_maximum_links: "Maximum number of linkbacks to create from one single post. When a post contains more links, none is created."+ github_permalinks_enabled: "Enable GitHub permalink overwrites"+ github_permalinks_exclude: "Filename or directory that should be excluded from permalink overwrites. Provide only filename or full path: user/repository/optional-directory/filename"+ github_badges_enabled: "Enable GitHub badges"+ github_badges_repos: "URLs of the GitHub repos to scan for contributions and commits"+ github_silver_badge_min_commits: "Minumum number of commits for silver badge"+ github_gold_badge_min_commits: "Minumum number of commits for gold badge"++ errors:+ invalid_badge_repo: "You must provide a GitHub URL or the repository name in the format github_user/repository_name"+ invalid_github_linkback_access_token: "You must provide a valid GitHub linkback access token which has access to the badge repositories you have provided."++ github_linkback:+ commit_template: |+ This commit has been mentioned on **%{title}**. There might be relevant details there:++ %{post_url}+ pr_template: |+ This pull request has been mentioned on **%{title}**. There might be relevant details there:++ %{post_url}+ issue_template: |+ This issue has been mentioned on **%{title}**. There might be relevant details there:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "Action required for discourse-github plugin"+ repository_identifier_invalid_pm: |+ A repository specified in the discourse-github plugin is invalid:+ %{repo_name}++ They should be specified as `user/repo`.++ Badges will not be awarded until the name is corrected in+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github Site Settings</a>+ and "github_badges_enabled" is turned back on.+ repository_not_found_pm_title: "Action required for discourse-github plugin"+ repository_not_found_pm: |+ A repository specified in the discourse-github plugin returned a "Not Found"+ error: %{repo_name}++ Badges will not be awarded until the name is corrected in+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github Site Settings</a>+ and "github_badges_enabled" is turned back on.+ invalid_octokit_credentials_pm_title: "Action required for discourse-github plugin"+ invalid_octokit_credentials_pm: |+ The GitHub credentials provided to the discourse-github plugin are invalid. The "github badges enabled\ site+ setting has been disabled, and commits will no longer be populated until the issue is resolved.++ Check your "github linkback access token" site setting to ensure the token is correct and has permission to all+ repos via+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github Site Settings</a>.diff --git a/plugins/discourse-github/config/locales/server.en_GB.yml b/plugins/discourse-github/config/locales/server.en_GB.ymlnew file mode 100644index 00000000000..2d4fa180ec7--- /dev/null+++ b/plugins/discourse-github/config/locales/server.en_GB.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++en_GB:diff --git a/plugins/discourse-github/config/locales/server.es.yml b/plugins/discourse-github/config/locales/server.es.ymlnew file mode 100644index 00000000000..17ed117f28c--- /dev/null+++ b/plugins/discourse-github/config/locales/server.es.yml@@ -0,0 +1,63 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++es:+ site_settings:+ enable_discourse_github_plugin: "Habilitar el plugin discourse-github"+ github_linkback_enabled: "Vincular problemas de GitHub a discusiones del foro"+ github_linkback_projects: "Lista de proyectos desde los que enlazar"+ github_linkback_access_token: 'Un token de acceso válido para el usuario que publicará el enlace de regreso y para contar commits/contribuciones para conceder insignias. Puedes obtener instrucciones sobre cómo obtener un token <a href="https://meta.discourse.org/t/99895">aquí</a>.'+ github_linkback_maximum_links: "Número máximo de enlaces a crear a partir de una sola entrada. Cuando una entrada contiene más enlaces, no se crea ninguno."+ github_permalinks_enabled: "Habilitar sobrescrituras de enlaces permanentes de GitHub"+ github_permalinks_exclude: "Nombre de archivo o directorio que debe excluirse de las sobrescrituras de enlaces permanentes. Proporciona solo el nombre de archivo o la ruta completa: usuario/repositorio/directorio-opcional/nombre_del_archivo"+ github_badges_enabled: "Habilitar insignias de GitHub"+ github_badges_repos: "URL de los repositorios de GitHub para buscar contribuciones y commits"+ github_silver_badge_min_commits: "Número mínimo de commits para la insignia de plata"+ github_gold_badge_min_commits: "Número mínimo de commits para la insignia de oro"+ errors:+ invalid_badge_repo: "Debes proporcionar una URL de GitHub o el nombre del repositorio en el formato github_user/nombre_del_repositorio"+ invalid_github_linkback_access_token: "Debes proporcionar un token de acceso de enlace de retorno de GitHub válido que tenga acceso a los repositorios de insignias que has proporcionado."+ github_linkback:+ commit_template: |+ Este commit ha sido mencionado en **%{title}**. Puede que haya detalles relevantes allí:++ %{post_url}+ pr_template: |+ Esta solicitud de extracción ha sido mencionada en **%{title}**. Puede que haya detalles relevantes allí:++ %{post_url}+ issue_template: |+ Este problema ha sido mencionado en **%{title}**. Puede que haya detalles relevantes allí:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "Acción requerida para el plugin discourse-github"+ repository_identifier_invalid_pm: |+ Un repositorio especificado en el plugin discourse-github no es válido:+ %{repo_name}++ Deben especificarse como `user/repo`.++ No se concederán insignias hasta que se corrija el nombre en+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">los Ajustes del sitio de discourse-github</a>+ y «github_badges_enabled» esté habilitado de nuevo.+ repository_not_found_pm_title: "Acción requerida para el plugin discourse-github"+ repository_not_found_pm: |+ Un repositorio especificado en el plugin discourse-github ha devuelto un error+ «No encontrado»: %{repo_name}++ No se concederán insignias hasta que se corrija el nombre en+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">los Ajustes del sitio de discourse-github</a>+ y «github_badges_enabled» esté habilitado de nuevo.+ invalid_octokit_credentials_pm_title: "Acción requerida para el plugin discourse-github"+ invalid_octokit_credentials_pm: |+ Las credenciales de GitHub proporcionadas al plugin discourse-github no son válidas. El ajuste «github badges enabled\ site»+ ha sido deshabilitada, y los commits ya no se poblarán hasta que el problema sea resuelto.++ Comprueba la configuración de tu «token de acceso al enlace de retorno de github» para asegurarte de que el token es correcto y tienes permiso para todos los+ repositorios a través de+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">los Ajustes del sitio de discourse-github</a>.diff --git a/plugins/discourse-github/config/locales/server.et.yml b/plugins/discourse-github/config/locales/server.et.ymlnew file mode 100644index 00000000000..0ea0b6d554b--- /dev/null+++ b/plugins/discourse-github/config/locales/server.et.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++et:diff --git a/plugins/discourse-github/config/locales/server.fa_IR.yml b/plugins/discourse-github/config/locales/server.fa_IR.ymlnew file mode 100644index 00000000000..c9285c2ee4e--- /dev/null+++ b/plugins/discourse-github/config/locales/server.fa_IR.yml@@ -0,0 +1,11 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++fa_IR:+ site_settings:+ enable_discourse_github_plugin: "افزونه discourse-github را فعال کنید"+ github_permalinks_enabled: "فعال کردن بازنویسی پیوند دائمی گیتهاب"+ github_badges_enabled: "فعال کردن نشانهای گیتهاب"diff --git a/plugins/discourse-github/config/locales/server.fi.yml b/plugins/discourse-github/config/locales/server.fi.ymlnew file mode 100644index 00000000000..8fb11767805--- /dev/null+++ b/plugins/discourse-github/config/locales/server.fi.yml@@ -0,0 +1,60 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++fi:+ site_settings:+ enable_discourse_github_plugin: "Ota discourse-github-lisäosa käyttöön"+ github_linkback_enabled: "Liitä GitHub-ongelmat foorumin keskusteluihin"+ github_linkback_projects: "Luettelo projekteista, joista voit linkittää takaisin"+ github_linkback_access_token: 'Kelvollinen käyttöoikeustietue käyttäjälle, joka julkaisee paluulinkin, ja solmujen/kontribuutioiden laskemiseen kunniamerkkien myöntämiseksi. Katso ohjeita tietueen saamiseen <a href="https://meta.discourse.org/t/99895">täältä</a>.'+ github_linkback_maximum_links: "Yhdestä viestistä julkaistavien paluulinkkien enimmäismäärä. Kun viesti sisältää enemmän linkkejä, yhtään ei luoda."+ github_permalinks_enabled: "Ota GitHubin pysyvien linkkien korvaaminen käyttöön"+ github_permalinks_exclude: "Tiedostonimi tai hakemisto, joka tulee sulkea pois pysyvien linkkien korvaamisesta. Anna vain tiedostonimi tai täydellinen polku: käyttäjä/tietovarasto/valinnainen-hakemisto/tiedostonimi"+ github_badges_enabled: "Ota GitHub-kunniamerkit käyttöön"+ github_badges_repos: "GitHub-tietovarastojen URL-osoitteet, joista etsitään kontribuutioita ja solmuja"+ github_silver_badge_min_commits: "Solmujen vähimmäismäärä hopeakunniamerkin saamiseksi"+ github_gold_badge_min_commits: "Solmujen vähimmäismäärä kultakunniamerkin saamiseksi"+ errors:+ invalid_badge_repo: "Sinun täytyy antaa GitHubin URL-osoite tai tietovaraston nimi muodossa github_käyttäjä/tietovaraston_nimi"+ invalid_github_linkback_access_token: "Sinun täytyy antaa kelvollinen GitHub-paluulinkin käyttöoikeustietue, jolla on antamiesi kunniamerkkitietovarastojen käyttöoikeus."+ github_linkback:+ commit_template: |+ Tämä solmu on mainittu ketjussa **%{title}**. Sieltä voi löytyä olennaisia tietoja:++ %{post_url}+ pr_template: |+ Tämä vetopyyntö on mainittu ketjussa **%{title}**. Sieltä voi löytyä olennaisia tietoja:++ %{post_url}+ issue_template: |+ Tämä seikka on mainittu ketjussa **%{title}**. Sieltä voi löytyä olennaisia tietoja:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "Discourse-github-lisäosa edellyttää toimenpiteitä"+ repository_identifier_invalid_pm: |+ Discourse-github-lisäosassa määritetty tietovarasto on virheellinen:+ %{repo_name}++ Ne tulisi määrittää muodossa "käyttäjä/tietovarasto".++ Kunniamerkkejä ei myönnetä ennen kuin nimi on korjattu+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-githubin sivustoasetuksissa</a>+ ja "github_badges_enabled" on otettu käyttöön uudelleen.+ repository_not_found_pm_title: "Discourse-github-lisäosa edellyttää toimenpiteitä"+ repository_not_found_pm: |+ Discourse-github-lisäosassa määritetty tietovarasto palautti "ei löydy" -virheen:+ %{repo_name}++ Kunniamerkkejä ei myönnetä ennen kuin nimi on korjattu+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-githubin sivustoasetuksissa</a>+ ja "github_badges_enabled" on otettu käyttöön uudelleen.+ invalid_octokit_credentials_pm_title: "Discourse-github-lisäosa edellyttää toimenpiteitä"+ invalid_octokit_credentials_pm: |+ Discourse-github-lisäosalle annetut GitHubin tunnistetiedot ovat virheellisiä. "Github badges enabled" -sivustoasetus on poistettu käytöstä, eikä solmuja enää täytetä ennen kuin ongelma on ratkaistu.++ Tarkista "github linkback access token" -sivustoasetuksesi varmistaaksesi, että tietue on oikea ja että sillä on kaikkien tietovarastojen käyttöoikeus <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-githubin sivustoasetuksissa</a>.diff --git a/plugins/discourse-github/config/locales/server.fr.yml b/plugins/discourse-github/config/locales/server.fr.ymlnew file mode 100644index 00000000000..7a59fb1be09--- /dev/null+++ b/plugins/discourse-github/config/locales/server.fr.yml@@ -0,0 +1,57 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++fr:+ site_settings:+ enable_discourse_github_plugin: "Activer l'extension discourse-github"+ github_linkback_enabled: "Relier les problèmes de GitHub aux discussions du forum"+ github_linkback_projects: "Liste des projets à partir desquels effectuer le lien"+ github_linkback_access_token: 'Un jeton d''accès valide pour l''utilisateur qui publiera le lien et pour compter les commits/contributions pour accorder des badges. Consultez <a href="https://meta.discourse.org/t/99895">cette page</a> pour savoir comment obtenir un jeton.'+ github_linkback_maximum_links: "Nombre maximal de liens à créer à partir d'un seul message. Lorsqu'un message contient plus de liens, aucun d'entre eux n'est créé."+ github_permalinks_enabled: "Activer les écrasements de permaliens GitHub"+ github_permalinks_exclude: "Nom de fichier ou répertoire à exclure des remplacements de permaliens. Indiquez uniquement le nom de fichier ou le chemin d'accès complet : user/repository/optional-directory/filename"+ github_badges_enabled: "Activer les badges GitHub"+ github_badges_repos: "Adresses URL des dépôts GitHub pour rechercher les contributions et les commits"+ github_silver_badge_min_commits: "Nombre minimal de commits pour le badge d'argent"+ github_gold_badge_min_commits: "Nombre minimal de commits pour le badge d'or"+ errors:+ invalid_badge_repo: "Vous devez fournir une adresse URL GitHub ou le nom du dépôt au format github_user/repository_name"+ invalid_github_linkback_access_token: "Vous devez fournir un jeton d'accès de lien GitHub valide qui donne accès aux dépôts de badges que vous avez fournis."+ github_linkback:+ commit_template: |+ Ce commit a été mentionné sur **%{title}**. Il pourrait y avoir des détails pertinents ici :++ %{post_url}+ pr_template: |+ Cette requête pull a été mentionnée sur **%{title}**. Il pourrait y avoir des détails pertinents ici :++ %{post_url}+ issue_template: |+ Ce problème a été mentionné sur **%{title}**. Il pourrait y avoir des détails pertinents ici :++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "Action requise pour l'extension discourse-github"+ repository_identifier_invalid_pm: |+ Un dépôt spécifié dans l'extension discourse-github n'est pas valide :+ %{repo_name}++ Ils doivent être spécifiés en tant que « user/repo ».++ Les badges ne seront pas attribués tant que le nom n'aura pas été corrigé dans les paramètres du site+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub"></a>+ et que « github_badges_enabled » ne sera pas réactivé.+ repository_not_found_pm_title: "Action requise pour l'extension discourse-github"+ repository_not_found_pm: |+ Un dépôt spécifié dans l'extension discourse-github a renvoyé une erreur+ %{repo_name}++ Les badges ne seront pas attribués tant que le nom n'aura pas été corrigé dans les+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">paramètres du site discourse-github</a>+ et que « github_badges_enabled » n'aura pas été réactivé.+ invalid_octokit_credentials_pm_title: "Action requise pour l'extension discourse-github"+ invalid_octokit_credentials_pm: "Les informations d'identification GitHub fournies à l'extension discourse-github ne sont pas valides. Le paramètre de site « badges github activés » \na été désactivé et les validations ne seront plus renseignées tant que le problème ne sera pas résolu.\n\nVérifiez le paramètre de site « jeton d'accès au lien github » pour vous assurer que le jeton est correct et autorisé à accéder à tous les\ndépôts via les\n<a href=\"%{base_path}/admin/site_settings/category/plugins?filter=GitHub\">paramètres de site discours-github</a>.\n"diff --git a/plugins/discourse-github/config/locales/server.gl.yml b/plugins/discourse-github/config/locales/server.gl.ymlnew file mode 100644index 00000000000..fb911ce1635--- /dev/null+++ b/plugins/discourse-github/config/locales/server.gl.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++gl:diff --git a/plugins/discourse-github/config/locales/server.he.yml b/plugins/discourse-github/config/locales/server.he.ymlnew file mode 100644index 00000000000..e2337770bc1--- /dev/null+++ b/plugins/discourse-github/config/locales/server.he.yml@@ -0,0 +1,59 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++he:+ site_settings:+ enable_discourse_github_plugin: "הפעלת התוסף discourse-github"+ github_linkback_enabled: "קישור תקלות ב־GitHub בחזרה לדיונים בפורום"+ github_linkback_projects: "רשימות של מיזמים לקשר מהם בחזרה"+ github_linkback_access_token: 'אסימון גישה תקף למשתמש שיפרסם את הקישור החוזה ולספירת הגשות/תרומות כדי להעניק עיטורים. ניתן לעיין <a href="https://meta.discourse.org/t/99895">כאן</a> להנחיות איך לקבל את האסימון.'+ github_linkback_maximum_links: "מספר הקישורים החוזרים המרבי ליצירה מפוסט יחיד. כאשר פוסט מכיל יותר קישורים, לא נוצרים כלל."+ github_permalinks_enabled: "הפעלת שכתוב כתובות קבועות של GitHub"+ github_permalinks_exclude: "שם קובץ או תיקייה שיוחרגו משכתובי הקישורים הקבועים. יש לספק שם קובץ או נתיב מלא בלבד: user/repository/optional-directory/filename"+ github_badges_enabled: "הפעלת עיטורים של GitHub"+ github_badges_repos: "כתובות של מאגרי GitHub לסריקה אחר תרומות והגשות"+ github_silver_badge_min_commits: "מספר ההגשות המזערי לעיטור כסף"+ github_gold_badge_min_commits: "מספר ההגשות המזערי לעיטור זהב"+ errors:+ invalid_badge_repo: "עליך לספק כתובת GitHub או את שם המאגר בצורה github_user/repository_name"+ invalid_github_linkback_access_token: "עליך לספק אסימון גישה תקף לקישור חוזר אל GitHub שיש לו גישה למאגרי העיטורים שסיפקת."+ github_linkback:+ commit_template: |+ הגשה (Commit) זו הוזכרה ב־**%{title}**. יכול להיות שיש פרטים קשורים כאן:++ %{post_url}+ pr_template: |+ בקשת דחיפה (Pull Request) זו הוזכרה ב־**%{title}**. יכול להיות שיש פרטים קשורים כאן:++ %{post_url}+ issue_template: |+ נושא (Issue) זה הוזכר ב־**%{title}**. יכול להיות שיש פרטים קשורים כאן:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "נדרשת פעולה עבור תוסף discourse-github"+ repository_identifier_invalid_pm: |+ מאגר שצוין ב־discourse-github שגוי:+ %{repo_name}++ יש לציין אותם בתור `user/repo` (משתמש/מאגר).++ לא יוענקו עיטורים עד שהשם יתוקן+ ב<a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">הגדרות האתר של discourse-github</a>+ ו־„github_badges_enabled” (עיטורים של GitHub פעילים) מופעל בחזרה.+ repository_not_found_pm_title: "נדרשת פעולה עבור תוסף discourse-github"+ repository_not_found_pm: |+ מאגר שצוין ב־discourse-github החזירה שגיאת „לא נמצא”: %{repo_name}++ לא יוענקו עיטורים עד שהשם יתוקן+ ב<a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">הגדרות האתר של discourse-github</a>+ ו־„github_badges_enabled” (עיטורים של GitHub פעילים) מופעל בחזרה.+ invalid_octokit_credentials_pm_title: "נדרשת פעולה עבור תוסף discourse-github"+ invalid_octokit_credentials_pm: |+ פרטי הגישה ל־GitHub שסופקו לתוסף discourse-github שגויים. הגדרת האתר „github badges enabled” הושבתה וההגשות לא ימולאו עד לפתרון התקלה.++ כדאי לבדוק את הגדרת האתר „github linkback access token” (אסימון גישה לקישור חוזר ל־GitHub) כדי לוודא שהאסימון נכון ושיש ללו הרשאות לכל המאגרים דרך <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">הגדרות האתר של discourse-github</a>.diff --git a/plugins/discourse-github/config/locales/server.hr.yml b/plugins/discourse-github/config/locales/server.hr.ymlnew file mode 100644index 00000000000..93343ce6e19--- /dev/null+++ b/plugins/discourse-github/config/locales/server.hr.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++hr:diff --git a/plugins/discourse-github/config/locales/server.hu.yml b/plugins/discourse-github/config/locales/server.hu.ymlnew file mode 100644index 00000000000..76b6e9d8bcb--- /dev/null+++ b/plugins/discourse-github/config/locales/server.hu.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++hu:diff --git a/plugins/discourse-github/config/locales/server.hy.yml b/plugins/discourse-github/config/locales/server.hy.ymlnew file mode 100644index 00000000000..cb18f64d356--- /dev/null+++ b/plugins/discourse-github/config/locales/server.hy.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++hy:diff --git a/plugins/discourse-github/config/locales/server.id.yml b/plugins/discourse-github/config/locales/server.id.ymlnew file mode 100644index 00000000000..596e36b2e13--- /dev/null+++ b/plugins/discourse-github/config/locales/server.id.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++id:diff --git a/plugins/discourse-github/config/locales/server.it.yml b/plugins/discourse-github/config/locales/server.it.ymlnew file mode 100644index 00000000000..d9fc6f9d439--- /dev/null+++ b/plugins/discourse-github/config/locales/server.it.yml@@ -0,0 +1,62 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++it:+ site_settings:+ enable_discourse_github_plugin: "Abilita il plugin discourse-github"+ github_linkback_enabled: "Collega i problemi di Github alle relative discussioni sul forum"+ github_linkback_projects: "Elenco dei progetti da collegare al forum"+ github_linkback_access_token: 'Un token di accesso valido per l''utente che pubblicherà il linkback e per il conteggio dei commit/contributi per la concessione di distintivi. Consulta <a href="https://meta.discourse.org/t/99895">qui</a> le istruzioni per ottenere un token.'+ github_linkback_maximum_links: "Numero massimo di linkback da creare da un singolo messaggio. Quando un messaggio contiene più link, non ne viene creato nessuno."+ github_permalinks_enabled: "Abilita le sovrascritture dei collegamenti GitHub permanenti"+ github_permalinks_exclude: "Nome del file o directory che dovrebbe essere esclusa dalle sovrascritture dei collegamenti permanenti. Fornisci solo il nome del file o il percorso completo: user/repository/optional-directory/filename"+ github_badges_enabled: "Abilita distintivi GitHub"+ github_badges_repos: "URL degli archivi GitHub per cercare contributi e commit"+ github_silver_badge_min_commits: "Numero minimo di commit per il distintivo d'argento"+ github_gold_badge_min_commits: "Numero minimo di commit per il distintivo d'oro"+ errors:+ invalid_badge_repo: "Devi fornire un URL GitHub o il nome dell'archivio nel formato github_user/repository_name"+ invalid_github_linkback_access_token: "Devi fornire un token valido di accesso al linkback GitHub che permette di accedere agli archivi dei distintivi che hai fornito."+ github_linkback:+ commit_template: |+ Questo problema è stato menzionato in **%{title}**. Lì potresti trovare informazioni rilevanti:++ %{post_url}+ pr_template: |+ Questa richiesta pull è stata menzionata in **%{title}**. Lì potresti trovare informazioni rilevanti:++ %{post_url}+ issue_template: |+ Questo problema è stato menzionato in **%{title}**. Lì potresti trovare informazioni rilevanti:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "Azione richiesta per il plug-in discourse-github"+ repository_identifier_invalid_pm: |+ Un archivio indicato nel plugin discourse-github non è valido:+ %{repo_name}++ Dovrebbe essere indicato in formato `user/repo`.++ I distintivi non saranno assegnati fino a quando il nome non sarà corretto nelle+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">Impostazioni del sito discourse-github</a>+ e l'opzione "github_badges_enabled" non sarà riattivata.+ repository_not_found_pm_title: "Azione richiesta per il plug-in discourse-github"+ repository_not_found_pm: |+ Un archivio indicato nel plugin discourse-github ha restituito un errore "Non trovato": %{repo_name}++ I distintivi non saranno assegnati fino a quando il nome non sarà corretto nelle+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">Impostazioni del sito discourse-github </a>+ e l'opzione "github_badges_enabled" non sarà riattivata.+ invalid_octokit_credentials_pm_title: "Azione richiesta per il plug-in discourse-github"+ invalid_octokit_credentials_pm: |+ Le credenziali GitHub fornite al plug-in discourse-github non sono valide. L'impostazione del sito "github badge enabled"+ è stata disabilitata e i commit non verranno più compilati fino a quando il problema non sarà risolto.++ Controlla l'impostazione del sito "github linkback access token" per assicurarti che il token sia corretto e abbia l'autorizzazione per tutti gli+ accessi tramite le+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">Impostazioni del sito discourse-github</a>.diff --git a/plugins/discourse-github/config/locales/server.ja.yml b/plugins/discourse-github/config/locales/server.ja.ymlnew file mode 100644index 00000000000..70cc52ce9d7--- /dev/null+++ b/plugins/discourse-github/config/locales/server.ja.yml@@ -0,0 +1,58 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ja:+ site_settings:+ enable_discourse_github_plugin: "discourse-github プラグインを有効にする"+ github_linkback_enabled: "GitHub の課題をフォーラムディスカッションにバックリンクする"+ github_linkback_projects: "バックリンクするプロジェクトのリスト"+ github_linkback_access_token: 'バックリンクを投稿するユーザー用とバッジを付与するためのコミット数/貢献数をカウントするための有効なアクセストークン。トークンの取得方法については、<a href="https://meta.discourse.org/t/99895">こちら</a>をご覧ください。'+ github_linkback_maximum_links: "1 つの投稿から作成できるリンクバックの最大数。投稿に複数のリンクが含まれる場合は、何も作成されません。"+ github_permalinks_enabled: "GitHub パーマリンクの上書きを有効にする"+ github_permalinks_exclude: "パーマリンクの上書きから除外する必要のあるファイル名またはディレクトリ。ファイル名のみ、またはフルパス(user/repository/optional-directory/filename)を指定します"+ github_badges_enabled: "GitHub バッジを有効にする"+ github_badges_repos: "貢献とコミットをスキャンする GitHub リポジトリの URL"+ github_silver_badge_min_commits: "シルバーバッジの最低コミット数"+ github_gold_badge_min_commits: "ゴールドバッジの最低コミット数"+ errors:+ invalid_badge_repo: "GitHub URL または github_user/repository_name の形式のリポジトリ名を指定する必要があります"+ invalid_github_linkback_access_token: "指定したバッジリポジトリにアクセスできる有効な GitHub バックリンクアクセストークンを指定する必要があります。"+ github_linkback:+ commit_template: |+ このコミットは **%{title}** でメンションされています。関連する詳細があるかもしれません。++ %{post_url}+ pr_template: |+ このプルリクエストは **%{title}** でメンションされています。関連する詳細があるかもしれません。++ %{post_url}+ issue_template: |+ この課題は **%{title}** でメンションされています。関連する詳細があるかもしれません。++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "discourse-github プラグインにアクションが必要です"+ repository_identifier_invalid_pm: |+ discourse-github プラグインに指定されたリポジトリは無効です:+ %{repo_name}++ `user/repo` の形式で指定されている必要があります。++ この名前が+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github のサイト設定</a>で修正され、"github_badges_enabled" がもう一度オンになるまで、バッジは授与されません。+ repository_not_found_pm_title: "discourse-github プラグインにアクションが必要です"+ repository_not_found_pm: |+ discourse-github プラグインに指定されたリポジトリから "見つかりません"+ エラーが返されました: %{repo_name}++ この名前が+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github のサイト設定</a>で修正され、"github_badges_enabled" がもう一度オンになるまで、バッジは授与されません。+ invalid_octokit_credentials_pm_title: "discourse-github プラグインにアクションが必要です"+ invalid_octokit_credentials_pm: |+ discourse-github プラグインに指定された GitHub 資格情報は無効です。"github badges enabled\ サイト設定が無効になっているため、この問題が解決するまでコミットは表示されません。++ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github サイト設定</a>から "GitHub バックリンクアクセストークン" サイト設定を確認し、トークンが正しく、すべてのリポジトリへの権限が付与されていることを確認してください。diff --git a/plugins/discourse-github/config/locales/server.ko.yml b/plugins/discourse-github/config/locales/server.ko.ymlnew file mode 100644index 00000000000..18dd77fd3ec--- /dev/null+++ b/plugins/discourse-github/config/locales/server.ko.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ko:diff --git a/plugins/discourse-github/config/locales/server.lt.yml b/plugins/discourse-github/config/locales/server.lt.ymlnew file mode 100644index 00000000000..16bb19758dc--- /dev/null+++ b/plugins/discourse-github/config/locales/server.lt.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++lt:diff --git a/plugins/discourse-github/config/locales/server.lv.yml b/plugins/discourse-github/config/locales/server.lv.ymlnew file mode 100644index 00000000000..59e0ef6f4ed--- /dev/null+++ b/plugins/discourse-github/config/locales/server.lv.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++lv:diff --git a/plugins/discourse-github/config/locales/server.nb_NO.yml b/plugins/discourse-github/config/locales/server.nb_NO.ymlnew file mode 100644index 00000000000..2e2224d1472--- /dev/null+++ b/plugins/discourse-github/config/locales/server.nb_NO.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++nb_NO:diff --git a/plugins/discourse-github/config/locales/server.nl.yml b/plugins/discourse-github/config/locales/server.nl.ymlnew file mode 100644index 00000000000..ca0dc819392--- /dev/null+++ b/plugins/discourse-github/config/locales/server.nl.yml@@ -0,0 +1,61 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++nl:+ site_settings:+ enable_discourse_github_plugin: "Discourse-Github-plug-in inschakelen"+ github_linkback_enabled: "GitHub-problemen teruglinken naar forumdiscussies"+ github_linkback_projects: "Lijst van projecten om van terug te linken"+ github_linkback_access_token: 'Een geldig toegangstoken voor de gebruiker die de teruglink plaatst en voor het tellen van commits/bijdragen om badges toe te kennen. Zie <a href="https://meta.discourse.org/t/99895">hier</a> voor instructies voor het verkrijgen van een token.'+ github_linkback_maximum_links: "Maximaal aantal teruglinks om te maken vanuit één enkele post. Als een bericht meer links bevat, wordt er geen gemaakt."+ github_permalinks_enabled: "Overschrijven van GitHub-permalink inschakelen"+ github_permalinks_exclude: "Bestandsnaam of map die moet worden uitgesloten van permalinkoverschrijvingen. Geef alleen de bestandsnaam of het volledige pad op: gebruiker/repository/optionele-directory/bestandsnaam"+ github_badges_enabled: "GitHub-badges inschakelen"+ github_badges_repos: "URL's van de GitHub-repository's om te scannen op bijdragen en commits"+ github_silver_badge_min_commits: "Minimaal aantal commits voor zilveren badge"+ github_gold_badge_min_commits: "Minimaal aantal commits voor gouden badge"+ errors:+ invalid_badge_repo: "Je moet een GitHub-URL of de repositorynaam opgeven in de vorm githubgebruiker/repositorynaam"+ invalid_github_linkback_access_token: "Je moet een geldig GitHub-linkbackaccesstoken opgeven dat toegang heeft tot de door jou opgegeven badgerepository's."+ github_linkback:+ commit_template: |+ Deze commit is vermeld op **%{title}**. Er kunnen relevante details zijn:++ %{post_url}+ pr_template: |+ Dit pullverzoek is vermeld op **%{title}**. Er kunnen relevante details zijn:++ %{post_url}+ issue_template: |+ Dit probleem is vermeld op **%{title}**. Er kunnen relevante details zijn:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "Actie vereist voor Discourse-Github-plug-in"+ repository_identifier_invalid_pm: |+ Een repository opgegeven in de Discourse-Github-plug-in is ongeldig:+ %{repo_name}++ Deze moet worden opgegeven als 'gebruiker/respository'.++ Badges worden pas toegekend als de naam is gecorrigeerd in+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">Discourse-Github-site-instellingen</a>+ en 'github_badges_enabled' weer is ingeschakeld.+ repository_not_found_pm_title: "Actie vereist voor Discourse-Github-plug-in"+ repository_not_found_pm: |+ Een repository opgegeven in de Discourse-Github-plug-in heeft een 'Niet gevonden'-fout+ geretourneerd: %{repo_name}++ Badges worden pas toegekend als de naam is gecorrigeerd in+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">Discourse-Github-site-instellingen</a>+ en 'github_badges_enabled' weer is ingeschakeld.+ invalid_octokit_credentials_pm_title: "Actie vereist voor Discourse-Github-plug-in"+ invalid_octokit_credentials_pm: |+ De GitHub-aanmeldgegevens die aan de Discourse-Github-plug-in zijn verstrekt, zijn ongeldig. De site-instelling 'github badges enabled' is uitgeschakeld en commits worden niet meer ingevuld totdat het probleem is opgelost.++ Controleer de site-instelling 'github linkback access token' om zeker te zijn dat het token juist is en toestemming heeft voor alle repository's via+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">Discourse-Github-site-instellingen</a>.diff --git a/plugins/discourse-github/config/locales/server.pl_PL.yml b/plugins/discourse-github/config/locales/server.pl_PL.ymlnew file mode 100644index 00000000000..52f508930bc--- /dev/null+++ b/plugins/discourse-github/config/locales/server.pl_PL.yml@@ -0,0 +1,13 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++pl_PL:+ site_settings:+ enable_discourse_github_plugin: "Włącz wtyczkę discourse-github"+ github_linkback_enabled: "Połącz problemy z GitHub z dyskusjami na forum"+ github_linkback_projects: "Lista projektów do odsyłania"+ github_linkback_access_token: 'Ważny token dostępu dla użytkownika, który opublikuje link zwrotny oraz do liczenia commitów/wkładów w celu przyznania odznak. Zerknij <a href="https://meta.discourse.org/t/99895">tutaj</a>, aby uzyskać instrukcje, jak zdobyć token.'+ github_badges_enabled: "Włącz odznaki GitHub"diff --git a/plugins/discourse-github/config/locales/server.pt.yml b/plugins/discourse-github/config/locales/server.pt.ymlnew file mode 100644index 00000000000..298ba523c1d--- /dev/null+++ b/plugins/discourse-github/config/locales/server.pt.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++pt:diff --git a/plugins/discourse-github/config/locales/server.pt_BR.yml b/plugins/discourse-github/config/locales/server.pt_BR.ymlnew file mode 100644index 00000000000..e24d4231bca--- /dev/null+++ b/plugins/discourse-github/config/locales/server.pt_BR.yml@@ -0,0 +1,62 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++pt_BR:+ site_settings:+ enable_discourse_github_plugin: "Ativar o plugin discourse-github"+ github_linkback_enabled: "O link do Github envia de volta para discussões do fórum"+ github_linkback_projects: "Lista de projetos para fazer linkback"+ github_linkback_access_token: 'Um token de acesso válido para o(a) usuário(a) que postar o linkback e contar confirmações/contribuições para conceder emblemas. Acesse <a href="https://meta.discourse.org/t/99895">aqui</a> para obter instruções de como receber um token.'+ github_linkback_maximum_links: "Número máximo de linkbacks para criar a partir de uma única postagem. Quando uma postagem contiver mais links, nenhum será criado."+ github_permalinks_enabled: "Ativar substituições de permalink do GitHub"+ github_permalinks_exclude: "Diretório ou nome do arquivo que deve ser excluído das substituições de permalink. Informe apenas o nome do arquivo ou caminho completo: user/repository/optional-directory/filename"+ github_badges_enabled: "Ativar emblemas do GitHub"+ github_badges_repos: "URLs do repositório do GitHub para verificar contribuições e confirmações"+ github_silver_badge_min_commits: "Número mínimo de confirmações para emblema de prata"+ github_gold_badge_min_commits: "Número mínimo de confirmações para emblema de ouro"+ errors:+ invalid_badge_repo: "Você deve informar uma URL do GitHub ou o nome do repositório no formato github_user/repository_name"+ invalid_github_linkback_access_token: "Você deve informar um token válido de acesso ao linkback do GitHub, com acesso aos repositórios do emblema informados."+ github_linkback:+ commit_template: |+ A confirmação foi mencionada em **%{title}**. Pode haver detalhes importantes:++ %{post_url}+ pr_template: |+ O pedido de recebimento foi mencionado em **%{title}**. Pode haver detalhes importantes:++ %{post_url}+ issue_template: |+ Este problema foi mencionado em **%{title}**. Pode haver detalhes importantes:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "Ação necessária para o plugin discourse-github"+ repository_identifier_invalid_pm: |+ Um repositório especificado no plugin discourse-github não é válido:+ %{repo_name}++ Deve ser especificado como "user/repo".++ Emblemas não serão concedidos até que o nome seja corrigido+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">Configurações do site do discourse-github</a>+ e "github_badges_enabled" seja reativado.+ repository_not_found_pm_title: "Ação necessária para o plugin discourse-github"+ repository_not_found_pm: |+ Um repositório especificado no plugin discourse-github retornou um "Não encontrado"+ %{repo_name}++ Emblemas não serão concedidos até que o nome seja corrigido+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">Configurações do site do discourse-github</a>+ e "github_badges_enabled" seja reativado.+ invalid_octokit_credentials_pm_title: "Ação necessária para o plugin discourse-github"+ invalid_octokit_credentials_pm: |+ As credenciais do GitHub informadas ao plugin discourse-github não são válidas. A configuração "github badges enabled\site"+ foi desativada, e as confirmações não serão mais preenchidas até que o problema seja solucionado.++ Confira a configuração do site "github linkback access token" para garantir que o token está correto e tem permissão para todos os respositórios via+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github Site Settings</a>.diff --git a/plugins/discourse-github/config/locales/server.ro.yml b/plugins/discourse-github/config/locales/server.ro.ymlnew file mode 100644index 00000000000..08a77f812ee--- /dev/null+++ b/plugins/discourse-github/config/locales/server.ro.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ro:diff --git a/plugins/discourse-github/config/locales/server.ru.yml b/plugins/discourse-github/config/locales/server.ru.ymlnew file mode 100644index 00000000000..64cb63cfebf--- /dev/null+++ b/plugins/discourse-github/config/locales/server.ru.yml@@ -0,0 +1,61 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ru:+ site_settings:+ enable_discourse_github_plugin: "Включить плагин discourse-github"+ github_linkback_enabled: "Связать тикеты GitHub с обсуждениями на форуме"+ github_linkback_projects: "Список проектов, на которые можно ссылаться"+ github_linkback_access_token: 'Действующий токен доступа для пользователя, который будет размещать обратную ссылку и для подсчёта коммитов/вкладов при присвоении наград. Получение токена описано в <a href="https://meta.discourse.org/t/99895">этой теме</a>.'+ github_linkback_maximum_links: "Максимальное количество обратных ссылок, создаваемых из одного сообщения. Если сообщение содержит больше ссылок - ни одна не создается."+ github_permalinks_enabled: "Включить перезапись постоянных ссылок GitHub"+ github_permalinks_exclude: "Имя файла или каталога, которые следует исключить из перезаписи постоянных ссылок. Укажите только имя файла или полный путь: пользователь/репозиторий/необязательный каталог/имя файла"+ github_badges_enabled: "Включить награды GitHub"+ github_badges_repos: "URL-адреса репозиториев GitHub для проверки вкладов и коммитов"+ github_silver_badge_min_commits: "Минимальное количество коммитов для получения серебряного значка"+ github_gold_badge_min_commits: "Минимальное количество коммитов для получения золотого значка"+ errors:+ invalid_badge_repo: "Вы должны предоставить URL GitHub или имя репозитория в формате 'github_пользователь/название_репозитория'"+ invalid_github_linkback_access_token: "Необходимо указать действующий токен доступа к GitHub Linkback, который имеет доступ к указанным вами репозиториям с наградами."+ github_linkback:+ commit_template: |+ Этот коммит был упомянут в **%{title}**. Там могут быть соответствующие подробности:++ %{post_url}+ pr_template: |+ Этот запрос на слияние был упомянут в **%{title}**. Там могут быть соответствующие подробности:++ %{post_url}+ issue_template: |+ Эта проблема была упомянута в **%{title}**. Там могут быть соответствующие подробности:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "Плагин «discourse-github» требует принятия мер"+ repository_identifier_invalid_pm: |+ Репозиторий, указанный в плагине «discourse-github», недействителен:+ %{repo_name}++ Он должен быть указан как `пользователь/репозиторий`.++ Награды не будут выдаваться до тех пор, пока название не будет исправлено в+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">настройках «discourse-github»</a>+ и параметр «github_badges_enabled» не будет снова включён.+ repository_not_found_pm_title: "Плагин «discourse-github» требует принятия мер"+ repository_not_found_pm: |+ Репозиторий, указанный в плагине discourse-github, выдаёт ошибку «Не найдено»: %{repo_name}++ Награды не будут выдаваться до тех пор, пока название не будет исправлено в+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">настройках «discourse-github»</a>+ и параметр «github_badges_enabled» не будет снова включён.+ invalid_octokit_credentials_pm_title: "Плагин «discourse-github» требует принятия мер"+ invalid_octokit_credentials_pm: |+ Учётные данные GitHub, предоставленные плагину «discourse-github», недействительны. Награды Github отключены, коммиты не будут заполняться, пока проблема не будет решена.++ Проверьте настройку токена доступа Github Linkback: токен должен быть действителен и должен иметь право доступа ко всем+ репозиториям — см.+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">настройки «discourse-github»</a>.diff --git a/plugins/discourse-github/config/locales/server.sk.yml b/plugins/discourse-github/config/locales/server.sk.ymlnew file mode 100644index 00000000000..6f815624081--- /dev/null+++ b/plugins/discourse-github/config/locales/server.sk.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sk:diff --git a/plugins/discourse-github/config/locales/server.sl.yml b/plugins/discourse-github/config/locales/server.sl.ymlnew file mode 100644index 00000000000..23489a48b1f--- /dev/null+++ b/plugins/discourse-github/config/locales/server.sl.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sl:diff --git a/plugins/discourse-github/config/locales/server.sq.yml b/plugins/discourse-github/config/locales/server.sq.ymlnew file mode 100644index 00000000000..7f051b7a7cf--- /dev/null+++ b/plugins/discourse-github/config/locales/server.sq.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sq:diff --git a/plugins/discourse-github/config/locales/server.sr.yml b/plugins/discourse-github/config/locales/server.sr.ymlnew file mode 100644index 00000000000..88d63d6ae1a--- /dev/null+++ b/plugins/discourse-github/config/locales/server.sr.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sr:diff --git a/plugins/discourse-github/config/locales/server.sv.yml b/plugins/discourse-github/config/locales/server.sv.ymlnew file mode 100644index 00000000000..fe3be0a8b3b--- /dev/null+++ b/plugins/discourse-github/config/locales/server.sv.yml@@ -0,0 +1,63 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sv:+ site_settings:+ enable_discourse_github_plugin: "Aktivera insticksprogrammet Discourse-github"+ github_linkback_enabled: "Länka GitHub-ärenden tillbaka till forumdiskussioner"+ github_linkback_projects: "Lista över projekt att länka tillbaka från"+ github_linkback_access_token: 'En giltig åtkomsttoken för användaren som lägger upp återlänken samt för att räkna åtaganden/bidrag för att ge märken. Se <a href="https://meta.discourse.org/t/99895">här</a> för instruktioner om hur du skaffar en token.'+ github_linkback_maximum_links: "Maximalt antal återlänkar att skapa från ett enda inlägg. När ett inlägg innehåller fler länkar skapas inga."+ github_permalinks_enabled: "Aktivera överskrivning av GitHub-permalänk"+ github_permalinks_exclude: "Filnamn eller katalog som bör uteslutas från permalänksöverskrivningar. Ange endast filnamn eller fullständig sökväg: user/repository/optional-directory/filname"+ github_badges_enabled: "Aktivera GitHub-märken"+ github_badges_repos: "Webbadresser till GitHub-depåer för att söka efter bidrag och åtaganden"+ github_silver_badge_min_commits: "Minsta antal åtaganden för silvermärke"+ github_gold_badge_min_commits: "Minsta antal åtaganden för guldmärke"+ errors:+ invalid_badge_repo: "Du måste ange en GitHub-URL eller databasnamnet i formatet github_user/repository_name"+ invalid_github_linkback_access_token: "Du måste ange en giltig GitHub återkopplingsbehörighetstoken som har åtkomst till de märkesdatabaser som du har angett."+ github_linkback:+ commit_template: |+ Detta åtagande har nämnts i **%{title}**. Det kan finnas relevanta detaljer där:++ %{post_url}+ pr_template: |+ Denna dragbegäran har nämnts i **%{title}**. Det kan finnas relevanta detaljer där:++ %{post_url}+ issue_template: |+ Detta ärende har nämnts i **%{title}**. Det kan finnas relevanta detaljer där:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "Åtgärd krävs för insticksprogrammet discourse-github"+ repository_identifier_invalid_pm: |+ En databas som anges i insticksprogrammet Discourse-github är ogiltig:+ %{repo_name}++ De bör anges som `user/repo`.++ Märken tilldelas inte förrän namnet har korrigerats i+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github webbplatsinställningar</a>+ och ”github_badges_enabled” är aktiverat igen.+ repository_not_found_pm_title: "Åtgärd krävs för insticksprogrammet discourse-github"+ repository_not_found_pm: |+ En databas som anges i insticksprogrammet Discourse-github returnerade felet ”Hittas inte”+ : %{repo_name}++ Märken kommer inte att tilldelas förrän namnet har korrigerats i+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github webbplatsinställningar</a>+ och ”github_badges_enabled” är aktiverat igen.+ invalid_octokit_credentials_pm_title: "Åtgärd krävs för insticksprogrammet discourse-github"+ invalid_octokit_credentials_pm: |+ GitHubs autentiseringsuppgifter som angivits till insticksprogrammet discourse-github är ogiltiga. Inställningen ”github märken aktiverad"+ har inaktiverats, och åtaganden kommer inte längre att fyllas i förrän problemet är löst.++ Kontrollera inställningen ”github linkback access token” för att säkerställa att token är korrekt och har behörighet till alla+ depåer via+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github webbplatsinställningar</a>.diff --git a/plugins/discourse-github/config/locales/server.sw.yml b/plugins/discourse-github/config/locales/server.sw.ymlnew file mode 100644index 00000000000..0d7cdd075bf--- /dev/null+++ b/plugins/discourse-github/config/locales/server.sw.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++sw:diff --git a/plugins/discourse-github/config/locales/server.te.yml b/plugins/discourse-github/config/locales/server.te.ymlnew file mode 100644index 00000000000..03967bdbb07--- /dev/null+++ b/plugins/discourse-github/config/locales/server.te.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++te:diff --git a/plugins/discourse-github/config/locales/server.th.yml b/plugins/discourse-github/config/locales/server.th.ymlnew file mode 100644index 00000000000..7de85ff91c4--- /dev/null+++ b/plugins/discourse-github/config/locales/server.th.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++th:diff --git a/plugins/discourse-github/config/locales/server.tr_TR.yml b/plugins/discourse-github/config/locales/server.tr_TR.ymlnew file mode 100644index 00000000000..6b580001658--- /dev/null+++ b/plugins/discourse-github/config/locales/server.tr_TR.yml@@ -0,0 +1,63 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++tr_TR:+ site_settings:+ enable_discourse_github_plugin: "discourse-github eklentisini etkinleştirin"+ github_linkback_enabled: "GitHub sorunlarını forum tartışmalarına geri bağlayın"+ github_linkback_projects: "Geri bağlantı kurulacak projelerin listesi"+ github_linkback_access_token: 'Geri bağlantıyı gönderecek kullanıcı için ve rozet vermek üzere taahhütleri/katkıları saymak için geçerli bir erişim token''ı. Nasıl token alınacağına ilişkin talimatlar için <a href="https://meta.discourse.org/t/99895">burayı</a> inceleyin.'+ github_linkback_maximum_links: "Tek bir gönderiden oluşturulacak maksimum geri bağlantı sayısı. Bir gönderi daha fazla bağlantı içeriyorsa hiçbiri oluşturulmaz."+ github_permalinks_enabled: "GitHub kalıcı bağlantılarının üzerine yazmayı etkinleştirin"+ github_permalinks_exclude: "Kalıcı bağlantı üzerine yazma işlemlerinin dışında bırakılması gereken dosya adı veya dizin. Yalnızca dosya adı veya tam yol sağlayın: kullanıcı/havuz/isteğe bağlı dizin/dosya adı"+ github_badges_enabled: "GitHub rozetlerini etkinleştirin"+ github_badges_repos: "Katkılar ve taahhütler için taranacak GitHub depolarının URL'leri"+ github_silver_badge_min_commits: "Gümüş rozet için minimum taahhüt sayısı"+ github_gold_badge_min_commits: "Altın rozet için minimum taahhüt sayısı"+ errors:+ invalid_badge_repo: "Bir GitHub URL'si veya depo adını github_user/repository_name biçiminde sağlamalısınız"+ invalid_github_linkback_access_token: "Sağladığınız rozet depolarına erişimi olan geçerli bir GitHub linkback erişim token'ı sağlamalısınız."+ github_linkback:+ commit_template: |+ Bu taahhütten **%{title}** başlığında bahsedildi. Orada ilgili ayrıntılar olabilir:++ %{post_url}+ pr_template: |+ Bu çekme talebinden **%{title}** başlığında bahsedildi. Orada ilgili ayrıntılar olabilir:++ %{post_url}+ issue_template: |+ Bu sorundan **%{title}** başlığında bahsedildi. Orada ilgili ayrıntılar olabilir:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "discourse-github eklentisi için eylem gerekli"+ repository_identifier_invalid_pm: |+ discourse-github eklentisinde belirtilen bir depo geçersiz:+ %{repo_name}++ "user/repo" olarak belirtilmeliler.++ İsim+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github Site Ayarları</a>+ adresinde düzeltilene ve "github_badges_enabled" tekrar açılana kadar rozet verilmeyecek.+ repository_not_found_pm_title: "discourse-github eklentisi için eylem gerekli"+ repository_not_found_pm: |+ discourse-github eklentisinde belirtilen bir depo "Bulunamadı"+ hatası döndürdü: %{repo_name}++ İsim+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github Site Ayarları</a>+ içinde düzeltilene ve "github_badges_enabled" tekrar açılana kadar rozet verilmeyecek.+ invalid_octokit_credentials_pm_title: "discourse-github eklentisi için eylem gerekli"+ invalid_octokit_credentials_pm: |+ discourse-github eklentisine eklenen GitHub kimlik bilgileri geçersiz. "github rozetleri etkin\ site+ ayarı devre dışı ve sorun çözülene kadar taahhütler doldurulmayacak.++ Belirtecin doğru olduğundan ve+ <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github Site Ayarları</a> aracılığıyla tüm+ depolara izne sahip olduğundan emin olmak için "github geri bağlantı erişim token'ı" site ayarınızı kontrol edin.diff --git a/plugins/discourse-github/config/locales/server.ug.yml b/plugins/discourse-github/config/locales/server.ug.ymlnew file mode 100644index 00000000000..a6bf0185ae2--- /dev/null+++ b/plugins/discourse-github/config/locales/server.ug.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ug:diff --git a/plugins/discourse-github/config/locales/server.uk.yml b/plugins/discourse-github/config/locales/server.uk.ymlnew file mode 100644index 00000000000..f1390545d1d--- /dev/null+++ b/plugins/discourse-github/config/locales/server.uk.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++uk:diff --git a/plugins/discourse-github/config/locales/server.ur.yml b/plugins/discourse-github/config/locales/server.ur.ymlnew file mode 100644index 00000000000..b4a9c21ee2f--- /dev/null+++ b/plugins/discourse-github/config/locales/server.ur.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++ur:diff --git a/plugins/discourse-github/config/locales/server.vi.yml b/plugins/discourse-github/config/locales/server.vi.ymlnew file mode 100644index 00000000000..f629dcf5329--- /dev/null+++ b/plugins/discourse-github/config/locales/server.vi.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++vi:diff --git a/plugins/discourse-github/config/locales/server.zh_CN.yml b/plugins/discourse-github/config/locales/server.zh_CN.ymlnew file mode 100644index 00000000000..d6dc8f880cb--- /dev/null+++ b/plugins/discourse-github/config/locales/server.zh_CN.yml@@ -0,0 +1,55 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++zh_CN:+ site_settings:+ enable_discourse_github_plugin: "启用 discourse-github 插件"+ github_linkback_enabled: "将 GitHub 议题链接回论坛讨论"+ github_linkback_projects: "待链接回的项目列表"+ github_linkback_access_token: '一个有效访问令牌,用于将发布反向链接的用户以及计算提交/贡献以授予徽章。有关如何获取令牌的说明,请参阅<a href="https://meta.discourse.org/t/99895">此处</a>。'+ github_linkback_maximum_links: "从单个帖子创建的最大反向链接数。当帖子包含更多链接时,将不会创建任何链接。"+ github_permalinks_enabled: "启用 GitHub 永久链接覆盖"+ github_permalinks_exclude: "应从永久链接覆盖中排除的文件名或目录。仅提供文件名或完整路径:user/repository/optional-directory/filename"+ github_badges_enabled: "启用 GitHub 徽章"+ github_badges_repos: "用于扫描贡献和提交的 GitHub 仓库的 URL"+ github_silver_badge_min_commits: "白银徽章的最低提交次数"+ github_gold_badge_min_commits: "黄金徽章的最低提交次数"+ errors:+ invalid_badge_repo: "您必须提供 GitHub URL 或格式为 github_user/repository_name 的仓库名称"+ invalid_github_linkback_access_token: "您必须提供有效的 GitHub 反向链接访问令牌,该令牌应该可以访问您提供的徽章仓库。"+ github_linkback:+ commit_template: |+ 此提交已在 **%{title}** 上被提及。那里可能有相关详细信息:++ %{post_url}+ pr_template: |+ 此拉取请求已在 **%{title}** 上被提及。那里可能有相关详细信息:++ %{post_url}+ issue_template: |+ 此问题已在 **%{title}** 上被提及。那里可能有相关详细信息:++ %{post_url}+ github_commits_populator:+ errors:+ repository_identifier_invalid_pm_title: "discourse-github 插件所需操作"+ repository_identifier_invalid_pm: |+ discourse-github 插件中指定的仓库无效:+ %{repo_name}++ 它们应该被指定为 `user/repo`。++ 除非在 <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github 站点设置</a>中更正名称并重新打开“github_badges_enabled”,否则不会授予徽章。+ repository_not_found_pm_title: "discourse-github 插件所需操作"+ repository_not_found_pm: |+ discourse-github 插件中指定的仓库返回了“找不到”错误:%{repo_name}++ 除非在 <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github 站点设置</a>中更正名称并重新打开“github_badges_enabled”,否则不会授予徽章。+ invalid_octokit_credentials_pm_title: "discourse-github 插件所需操作"+ invalid_octokit_credentials_pm: |+ 提供给 discourse-github 插件的 GitHub 凭据无效。“github badges enabled”站点设置已被禁用,并且在议题解决之前将不会填充提交。++ 检查您的“github 反向链接访问令牌”站点设置,确保令牌正确并通过 <a href="%{base_path}/admin/site_settings/category/plugins?filter=GitHub">discourse-github 站点设置</a>获得对所有仓库的权限。diff --git a/plugins/discourse-github/config/locales/server.zh_TW.yml b/plugins/discourse-github/config/locales/server.zh_TW.ymlnew file mode 100644index 00000000000..7e15fab0018--- /dev/null+++ b/plugins/discourse-github/config/locales/server.zh_TW.yml@@ -0,0 +1,7 @@+# WARNING: Never edit this file.+# It will be overwritten when translations are pulled from Crowdin.+#+# To work with us on translations, join this project:+# https://translate.discourse.org/++zh_TW:diff --git a/plugins/discourse-github/config/settings.yml b/plugins/discourse-github/config/settings.ymlnew file mode 100644index 00000000000..d3dbee64c40--- /dev/null+++ b/plugins/discourse-github/config/settings.yml@@ -0,0 +1,32 @@+discourse_github:+ enable_discourse_github_plugin:+ default: false+ github_linkback_enabled:+ default: false+ github_linkback_projects:+ default: ""+ type: list+ github_linkback_access_token:+ default: ""+ secret: true+ validator: "GithubLinkbackAccessTokenSettingValidator"+ github_linkback_maximum_links:+ default: 25+ min: 1+ github_badges_enabled:+ default: false+ github_badges_repos:+ default: ""+ type: list+ validator: "GithubBadgesRepoSettingValidator"+ github_permalinks_enabled:+ default: false+ github_permalinks_exclude:+ default: "README.md"+ type: list+ github_silver_badge_min_commits:+ default: 25+ min: 1+ github_gold_badge_min_commits:+ default: 250+ min: 1diff --git a/plugins/discourse-github/db/migrate/20190617035051_rename_site_setting_github_badges_repo.rb b/plugins/discourse-github/db/migrate/20190617035051_rename_site_setting_github_badges_repo.rbnew file mode 100644index 00000000000..858fe954693--- /dev/null+++ b/plugins/discourse-github/db/migrate/20190617035051_rename_site_setting_github_badges_repo.rb@@ -0,0 +1,15 @@+# frozen_string_literal: true++class RenameSiteSettingGithubBadgesRepo < ActiveRecord::Migration[5.2]+ def up+ execute(<<~SQL)+ UPDATE site_settings SET name = 'github_badges_repos', data_type = 8 WHERE name = 'github_badges_repo' AND data_type = 1+ SQL+ end++ def down+ execute(<<~SQL)+ UPDATE site_settings SET name = 'github_badges_repo', data_type = 1 WHERE name = 'github_badges_repos' AND data_type = 8+ SQL+ end+enddiff --git a/plugins/discourse-github/db/migrate/20190618174229_create_github_repos.rb b/plugins/discourse-github/db/migrate/20190618174229_create_github_repos.rbnew file mode 100644index 00000000000..c2204c95835--- /dev/null+++ b/plugins/discourse-github/db/migrate/20190618174229_create_github_repos.rb@@ -0,0 +1,11 @@+# frozen_string_literal: true++class CreateGithubRepos < ActiveRecord::Migration[5.2]+ def change+ create_table :github_repos do |t|+ t.string :name, null: false, limit: 255+ t.timestamps null: false+ end+ add_index :github_repos, :name, unique: true+ end+enddiff --git a/plugins/discourse-github/db/migrate/20190618183340_create_github_commits.rb b/plugins/discourse-github/db/migrate/20190618183340_create_github_commits.rbnew file mode 100644index 00000000000..9c88fdffaca--- /dev/null+++ b/plugins/discourse-github/db/migrate/20190618183340_create_github_commits.rb@@ -0,0 +1,15 @@+# frozen_string_literal: true++class CreateGithubCommits < ActiveRecord::Migration[5.2]+ def change+ create_table :github_commits do |t|+ t.references :repo, null: false+ t.string :sha, limit: 40, null: false+ t.string :email, limit: 513, null: false+ t.timestamp :committed_at, null: false+ t.integer :role_id, null: false+ t.boolean :merge_commit, null: false, default: false+ t.timestamps null: false+ end+ end+enddiff --git a/plugins/discourse-github/db/migrate/20201210032852_discourse_github_rebuild_git_history.rb b/plugins/discourse-github/db/migrate/20201210032852_discourse_github_rebuild_git_history.rbnew file mode 100644index 00000000000..cbf931eca44--- /dev/null+++ b/plugins/discourse-github/db/migrate/20201210032852_discourse_github_rebuild_git_history.rb@@ -0,0 +1,15 @@+# frozen_string_literal: true++class DiscourseGithubRebuildGitHistory < ActiveRecord::Migration[6.0]+ def up+ # the table will be repopulated the next time the `UpdateJob` runs.+ # This will not have any noticeable effects on the site because+ # this table is merely used to grant the committer and contributor+ # badges. Deleting commits will not cause users to lose badges.+ execute "DELETE FROM github_commits"+ end++ def down+ raise ActiveRecord::IrreversibleMigration+ end+enddiff --git a/plugins/discourse-github/db/migrate/20230227050148_update_github_badge_icons.rb b/plugins/discourse-github/db/migrate/20230227050148_update_github_badge_icons.rbnew file mode 100644index 00000000000..4a643e217d7--- /dev/null+++ b/plugins/discourse-github/db/migrate/20230227050148_update_github_badge_icons.rb@@ -0,0 +1,21 @@+# frozen_string_literal: true++class UpdateGithubBadgeIcons < ActiveRecord::Migration[7.0]+ def change+ badges = [+ DiscourseGithubPlugin::GithubBadges::BADGE_NAME_BRONZE,+ DiscourseGithubPlugin::GithubBadges::BADGE_NAME_SILVER,+ DiscourseGithubPlugin::GithubBadges::BADGE_NAME_GOLD,+ DiscourseGithubPlugin::GithubBadges::COMMITTER_BADGE_NAME_BRONZE,+ DiscourseGithubPlugin::GithubBadges::COMMITTER_BADGE_NAME_SILVER,+ DiscourseGithubPlugin::GithubBadges::COMMITTER_BADGE_NAME_GOLD,+ ]+ execute <<~SQL+ UPDATE badges+ SET icon = 'fab-git-alt'+ WHERE+ name IN (#{badges.map { |b| "'#{b}'" }.join(",")})+ AND icon = 'fa-certificate'+ SQL+ end+enddiff --git a/plugins/discourse-github/db/migrate/20250721192555_enable_github_if_already_installed.rb b/plugins/discourse-github/db/migrate/20250721192555_enable_github_if_already_installed.rbnew file mode 100644index 00000000000..d9e91ac29e9--- /dev/null+++ b/plugins/discourse-github/db/migrate/20250721192555_enable_github_if_already_installed.rb@@ -0,0 +1,23 @@+# frozen_string_literal: true++class EnableGithubIfAlreadyInstalled < ActiveRecord::Migration[7.2]+ def up+ installed_at = DB.query_single(<<~SQL)&.first+ SELECT created_at FROM schema_migration_details WHERE version='20190617035051'+ SQL++ if installed_at && installed_at < 1.hour.ago+ # The plugin was installed before we changed it to be disabled-by-default+ # Therefore, if there is no existing database value, enable the plugin+ execute <<~SQL+ INSERT INTO site_settings(name, data_type, value, created_at, updated_at)+ VALUES('enable_discourse_github_plugin', 5, 't', NOW(), NOW())+ ON CONFLICT (name) DO NOTHING+ SQL+ end+ end++ def down+ raise ActiveRecord::IrreversibleMigration+ end+enddiff --git a/plugins/discourse-github/plugin.rb b/plugins/discourse-github/plugin.rbnew file mode 100644index 00000000000..5770fdd4942--- /dev/null+++ b/plugins/discourse-github/plugin.rb@@ -0,0 +1,49 @@+# frozen_string_literal: true++# name: discourse-github+# about: Allows staff to assign badges to users based on GitHub contributions, and allows users to create Github Linkbacks and Permalinks+# meta_topic_id: 99895+# version: 0.3+# authors: Robin Ward, Sam Saffron+# url: https://github.com/discourse/discourse/tree/main/plugins/discourse-github++require "sawyer"+require "octokit"++# Site setting validators must be loaded before initialize+require_relative "app/lib/github_badges_repo_setting_validator.rb"+require_relative "app/lib/github_linkback_access_token_setting_validator.rb"++enabled_site_setting :enable_discourse_github_plugin++after_initialize do+ %w[+ ../app/models/github_commit.rb+ ../app/models/github_repo.rb+ ../app/lib/github_linkback.rb+ ../app/lib/github_badges.rb+ ../app/lib/github_permalinks.rb+ ../app/lib/commits_populator.rb+ ../app/jobs/regular/create_github_linkback.rb+ ../app/jobs/scheduled/grant_github_badges.rb+ ../app/jobs/regular/replace_github_non_permalinks.rb+ ].each { |path| require File.expand_path(path, __FILE__) }++ on(:post_created) do |post|+ if SiteSetting.github_linkback_enabled? && SiteSetting.enable_discourse_github_plugin?+ GithubLinkback.new(post).enqueue+ end+ end++ on(:post_edited) do |post|+ if SiteSetting.github_linkback_enabled? && SiteSetting.enable_discourse_github_plugin?+ GithubLinkback.new(post).enqueue+ end+ end++ on(:before_post_process_cooked) do |doc, post|+ if SiteSetting.github_permalinks_enabled? && SiteSetting.enable_discourse_github_plugin?+ GithubPermalinks.replace_github_non_permalinks(post)+ end+ end+enddiff --git a/plugins/discourse-github/spec/jobs/create_github_linkback_spec.rb b/plugins/discourse-github/spec/jobs/create_github_linkback_spec.rbnew file mode 100644index 00000000000..63aa8cd01cf--- /dev/null+++ b/plugins/discourse-github/spec/jobs/create_github_linkback_spec.rb@@ -0,0 +1,16 @@+# frozen_string_literal: true++require "rails_helper"++describe Jobs::CreateGithubLinkback do+ before do+ enable_current_plugin+ SiteSetting.github_linkback_enabled = true+ end++ it "shouldn't raise error if post not found" do+ post = Fabricate(:post)+ post.destroy!+ expect { Jobs::CreateGithubLinkback.new.execute(post_id: post.id) }.not_to raise_error+ end+enddiff --git a/plugins/discourse-github/spec/jobs/replace_github_non_permalinks_spec.rb b/plugins/discourse-github/spec/jobs/replace_github_non_permalinks_spec.rbnew file mode 100644index 00000000000..61a9498ec2d--- /dev/null+++ b/plugins/discourse-github/spec/jobs/replace_github_non_permalinks_spec.rb@@ -0,0 +1,115 @@+# frozen_string_literal: true++require "rails_helper"++describe Jobs::ReplaceGithubNonPermalinks do+ let(:job) { described_class.new }+ let(:github_url) do+ "https://github.com/test/onebox/blob/master/lib/onebox/engine/github_blob_onebox.rb"+ end+ let(:github_permanent_url) do+ "https://github.com/test/onebox/blob/815ea9c0a8ffebe7bd7fcd34c10ff28c7a6b6974/lib/onebox/engine/github_blob_onebox.rb"+ end+ let(:github_url2) { "https://github.com/test/discourse/blob/master/app/models/tag.rb#L1-L3" }+ let(:github_permanent_url2) do+ "https://github.com/test/discourse/blob/7e4edcfae8a3c0e664b836ee7c5f28b47853a2f8/app/models/tag.rb#L1-L3"+ end+ let(:broken_github_url) do+ "https://github.com/test/oneblob/blob/master/lib/onebox/engine/nonexistent.rb"+ end+ let(:github_response_body) { { sha: "815ea9c0a8ffebe7bd7fcd34c10ff28c7a6b6974", commit: {} } }+ let(:github_response_body2) { { sha: "7e4edcfae8a3c0e664b836ee7c5f28b47853a2f8", commit: {} } }++ before do+ enable_current_plugin++ stub_request(:get, "https://api.github.com/repos/test/onebox/commits/master").to_return(+ status: 200,+ body: github_response_body.to_json,+ headers: {+ },+ )+ stub_request(+ :get,+ "https://api.github.com/repos/test/onebox/commits/815ea9c0a8ffebe7bd7fcd34c10ff28c7a6b6974",+ ).to_return(status: 200, body: github_response_body.to_json, headers: {})+ stub_request(:get, "https://api.github.com/repos/test/oneblob/commits/master").to_return(+ status: 404,+ )+ stub_request(:get, "https://api.github.com/repos/test/discourse/commits/master").to_return(+ status: 200,+ body: github_response_body2.to_json,+ headers: {+ },+ )+ end++ describe "#execute" do+ before do+ Jobs.run_immediately!+ SiteSetting.github_permalinks_enabled = true+ end++ it "replaces link with permanent link" do+ stub_request(:head, github_permanent_url).to_return(status: 200, body: "", headers: {})+ stub_request(+ :get,+ "https://raw.githubusercontent.com/test/onebox/815ea9c0a8ffebe7bd7fcd34c10ff28c7a6b6974/lib/onebox/engine/github_blob_onebox.rb",+ ).to_return(status: 200, body: "", headers: {})++ post = Fabricate(:post, raw: github_url)+ job.execute(post_id: post.id)+ post.reload++ expect(post.raw).to eq(github_permanent_url)+ end++ it "doesn't replace the link if it's already permanent" do+ post = Fabricate(:post, raw: github_permanent_url)+ job.execute(post_id: post.id)+ post.reload++ expect(post.raw).to eq(github_permanent_url)+ end++ it "doesn't change the post if link is broken" do+ post = Fabricate(:post, raw: broken_github_url)+ job.execute(post_id: post.id)+ post.reload++ expect(post.raw).to eq(broken_github_url)+ end++ it "works with multiple github urls in the post" do+ stub_request(:get, github_permanent_url).to_return(status: 200, body: "")+ stub_request(:get, github_permanent_url2.gsub(/#.+$/, "")).to_return(status: 200, body: "")+ post = Fabricate(:post, raw: "#{github_url} #{github_url2} htts://github.com")+ job.execute(post_id: post.id)+ post.reload++ updated_post = "#{github_permanent_url} #{github_permanent_url2} htts://github.com"+ expect(post.raw).to eq(updated_post)+ end+ end++ describe "#excluded?" do+ before do+ SiteSetting.github_permalinks_exclude =+ "README.md|discourse/discourse/directory/file.rb|discourse/onebox/docs/*|discourse/anotherRepo/*|someUser/*"+ end++ it "returns true when it should be excluded" do+ expect(job.excluded?("discourse", "discourse", "README.md")).to be true+ expect(job.excluded?("discourse", "discourse", "directory/file.rb")).to be true+ expect(job.excluded?("discourse", "onebox", "docs/file.rb")).to be true+ expect(job.excluded?("discourse", "anotherRepo", "directory/file.rb")).to be true+ expect(job.excluded?("someUser", "someRepo", "file.rb")).to be true+ end++ it "return false when url should be replaced" do+ expect(job.excluded?("discourse", "discourse", "directory/file2.rb")).to be false+ expect(job.excluded?("discourse", "onebox", "directory/file.rb")).to be false+ expect(job.excluded?("discourse", "discourse", "directory/included.rb")).to be false+ end+ end+enddiff --git a/plugins/discourse-github/spec/lib/commits_populator_spec.rb b/plugins/discourse-github/spec/lib/commits_populator_spec.rbnew file mode 100644index 00000000000..b89da0a8053--- /dev/null+++ b/plugins/discourse-github/spec/lib/commits_populator_spec.rb@@ -0,0 +1,154 @@+# frozen_string_literal: true++require "rails_helper"++describe DiscourseGithubPlugin::CommitsPopulator do+ subject(:populator) { described_class.new(repo) }++ let(:repo) { DiscourseGithubPlugin::GithubRepo.new(name: "discourse/discourse") }+ let!(:site_admin1) { Fabricate(:admin) }+ let!(:site_admin2) { Fabricate(:admin) }++ before do+ enable_current_plugin+ SiteSetting.github_badges_enabled = true+ end++ context "when invalid credentials have been provided for octokit" do+ before { Octokit::Client.any_instance.expects(:branches).raises(Octokit::Unauthorized) }++ it "disables github badges and sends a PM to the admin of the site to inform them" do+ populator.populate!+ expect(SiteSetting.github_badges_enabled).to eq(false)+ sent_pm =+ Post+ .joins(:topic)+ .includes(:topic)+ .where("topics.archetype = ?", Archetype.private_message)+ .last+ expect(sent_pm.topic.allowed_users.include?(site_admin1)).to eq(true)+ expect(sent_pm.topic.allowed_users.include?(site_admin2)).to eq(true)+ expect(sent_pm.topic.title).to eq(+ I18n.t("github_commits_populator.errors.invalid_octokit_credentials_pm_title"),+ )+ expect(sent_pm.raw).to eq(+ I18n.t(+ "github_commits_populator.errors.invalid_octokit_credentials_pm",+ base_path: Discourse.base_path,+ ).strip,+ )+ end+ end++ context "when the repository is not found" do+ before { Octokit::Client.any_instance.expects(:branches).raises(Octokit::NotFound) }++ it "disables github badges and sends a PM to the admin of the site to inform them" do+ populator.populate!+ expect(SiteSetting.github_badges_enabled).to eq(false)+ sent_pm =+ Post+ .joins(:topic)+ .includes(:topic)+ .where("topics.archetype = ?", Archetype.private_message)+ .last+ expect(sent_pm.topic.allowed_users.include?(site_admin1)).to eq(true)+ expect(sent_pm.topic.allowed_users.include?(site_admin2)).to eq(true)+ expect(sent_pm.topic.title).to eq(+ I18n.t("github_commits_populator.errors.repository_not_found_pm_title"),+ )+ expect(sent_pm.raw).to eq(+ I18n.t(+ "github_commits_populator.errors.repository_not_found_pm",+ repo_name: repo.name,+ base_path: Discourse.base_path,+ ).strip,+ )+ end+ end++ context "when the repository identifier is invalid" do+ before { Octokit::Client.any_instance.expects(:branches).raises(Octokit::InvalidRepository) }++ it "disables github badges and sends a PM to the admin of the site to inform them" do+ populator.populate!+ expect(SiteSetting.github_badges_enabled).to eq(false)+ sent_pm =+ Post+ .joins(:topic)+ .includes(:topic)+ .where("topics.archetype = ?", Archetype.private_message)+ .last+ expect(sent_pm.topic.allowed_users.include?(site_admin1)).to eq(true)+ expect(sent_pm.topic.allowed_users.include?(site_admin2)).to eq(true)+ expect(sent_pm.topic.title).to eq(+ I18n.t("github_commits_populator.errors.repository_identifier_invalid_pm_title"),+ )+ expect(sent_pm.raw).to eq(+ I18n.t(+ "github_commits_populator.errors.repository_identifier_invalid_pm",+ repo_name: repo.name,+ base_path: Discourse.base_path,+ ).strip,+ )+ end+ end++ context "if some other octokit error is raised" do+ before { Octokit::Client.any_instance.expects(:branches).raises(Octokit::Error) }++ it "simply logs the error and does nothing else" do+ populator.populate!+ expect(SiteSetting.github_badges_enabled).to eq(true)+ end+ end++ context "if GraphQL returns no data" do+ before do+ branches_body = <<~JSON+ [+ {+ "name": "add-group-css-properties",+ "commit": {+ "sha": "0d67b6307042803c351599de715023841cfa9356",+ "url": "https://api.github.com/repos/discourse/discourse/commits/0d67b6307042803c351599de715023841cfa9356"+ },+ "protected": false+ }+ ]+ JSON++ graphql_response = <<~JSON+ {+ "message": "Bad credentials",+ "documentation_url": "https://docs.github.com/graphql"+ }+ JSON++ stub_request(+ :get,+ "https://api.github.com/repos/discourse/discourse/branches?per_page=100",+ ).to_return(status: 200, body: branches_body)+ stub_request(:post, "https://api.github.com/graphql").to_return(+ status: 200,+ body: graphql_response,+ headers: {+ "content-type": "application/json",+ },+ )+ end++ it "simply logs the error and does nothing else" do+ expect { populator.populate! }.to raise_error(described_class::GraphQLError)+ end+ end++ context "if github_badges_enabled is false" do+ before { SiteSetting.github_badges_enabled = false }++ it "early returns before attempting to execute any of the commit fetching, because the plugin likely disabled itself" do+ Octokit::Client.any_instance.expects(:branches).never+ populator.populate!+ end+ end+enddiff --git a/plugins/discourse-github/spec/lib/github_badges_repo_setting_validator_spec.rb b/plugins/discourse-github/spec/lib/github_badges_repo_setting_validator_spec.rbnew file mode 100644index 00000000000..10f4f8b13f6--- /dev/null+++ b/plugins/discourse-github/spec/lib/github_badges_repo_setting_validator_spec.rb@@ -0,0 +1,51 @@+# frozen_string_literal: true++require "rails_helper"++describe GithubBadgesRepoSettingValidator do+ subject(:validator) { described_class.new }++ before { enable_current_plugin }++ describe "#valid_value?" do+ context "when a github URL is provided" do+ let(:value) { "https://github.com/discourse/discourse/" }++ it "is ok" do+ expect(validator.valid_value?(value)).to eq(true)+ end+ end++ context "when a github repo in the format user/repo is provided" do+ let(:value) { "discourse/discourse-github" }++ it "is ok" do+ expect(validator.valid_value?(value)).to eq(true)+ end+ end++ context "when a github repo name by itself is provided" do+ let(:value) { "some-repo" }++ it "is not ok" do+ expect(validator.valid_value?(value)).to eq(false)+ end+ end++ context "when multiple valid settings are provided" do+ let(:value) { "discourse/discourse-github|https://github.com/discourse/discourse/" }++ it "is ok" do+ expect(validator.valid_value?(value)).to eq(true)+ end+ end++ context "when multiple valid settings with one invalid setting is provided" do+ let(:value) { "discourse/discourse-github|https://github.com/discourse/discourse/|bad-dog" }++ it "is not ok" do+ expect(validator.valid_value?(value)).to eq(false)+ end+ end+ end+enddiff --git a/plugins/discourse-github/spec/lib/github_badges_spec.rb b/plugins/discourse-github/spec/lib/github_badges_spec.rbnew file mode 100644index 00000000000..34aa1305310--- /dev/null+++ b/plugins/discourse-github/spec/lib/github_badges_spec.rb@@ -0,0 +1,157 @@+# frozen_string_literal: true++require "rails_helper"++describe DiscourseGithubPlugin::GithubBadges do+ let(:bronze_user) { Fabricate(:user) }+ let(:bronze_user_repo_2) { Fabricate(:user) }+ let(:silver_user) { Fabricate(:user) }+ let(:contributor) { Fabricate(:user) }+ let(:private_email_contributor) { Fabricate(:user) }+ let(:private_email_contributor2) { Fabricate(:user) }+ let(:merge_commit_user) { Fabricate(:user) }+ let(:staged_user) { Fabricate(:user, staged: true) }++ before { enable_current_plugin }++ describe "committer and contributor badges" do+ before do+ roles = DiscourseGithubPlugin::CommitsPopulator::ROLES+ SiteSetting.github_badges_repos =+ "https://github.com/org/repo1.git|https://github.com/org/repo2.git"+ repo1 = DiscourseGithubPlugin::GithubRepo.repos.find { |repo| repo.name == "org/repo1" }+ repo2 = DiscourseGithubPlugin::GithubRepo.repos.find { |repo| repo.name == "org/repo2" }+ repo1.commits.create!(+ sha: "1",+ email: bronze_user.email,+ committed_at: 1.day.ago,+ role_id: roles[:committer],+ )+ repo1.commits.create!(+ sha: "2",+ email: merge_commit_user.email,+ merge_commit: true,+ committed_at: 1.day.ago,+ role_id: roles[:committer],+ )+ repo1.commits.create!(+ sha: "3",+ email: contributor.email,+ committed_at: 1.day.ago,+ role_id: roles[:contributor],+ )+ 25.times do |n|+ repo1.commits.create!(+ sha: "blah#{n}",+ email: silver_user.email,+ committed_at: 1.day.ago,+ role_id: roles[:committer],+ )+ end+ repo2.commits.create!(+ sha: "4",+ email: bronze_user_repo_2.email,+ committed_at: 2.day.ago,+ role_id: roles[:committer],+ )++ UserAssociatedAccount.create!(+ provider_name: "github",+ user_id: private_email_contributor.id,+ info: {+ nickname: "bob",+ },+ provider_uid: 100,+ )+ repo1.commits.create!(+ sha: "123",+ email: "[email protected]",+ committed_at: 1.day.ago,+ role_id: roles[:contributor],+ )++ UserAssociatedAccount.create!(+ provider_name: "github",+ user_id: private_email_contributor2.id,+ info: {+ nickname: "joe",+ },+ provider_uid: 101,+ )+ repo1.commits.create!(+ sha: "124",+ email: "[email protected]",+ committed_at: 1.day.ago,+ role_id: roles[:contributor],+ )++ repo1.commits.create!(+ sha: "5",+ email: staged_user.email,+ committed_at: 1.day.ago,+ role_id: roles[:contributor],+ )+ end++ it "granted correctly" do+ # initial run to seed badges and then enable them+ DiscourseGithubPlugin::GithubBadges.grant!++ contributor_bronze = DiscourseGithubPlugin::GithubBadges::BADGE_NAME_BRONZE+ committer_bronze = DiscourseGithubPlugin::GithubBadges::COMMITTER_BADGE_NAME_BRONZE+ committer_silver = DiscourseGithubPlugin::GithubBadges::COMMITTER_BADGE_NAME_SILVER++ users = [+ bronze_user,+ bronze_user_repo_2,+ silver_user,+ contributor,+ staged_user,+ private_email_contributor,+ private_email_contributor2,+ merge_commit_user,+ ]+ users.each { |u| u.badges.destroy_all }++ [committer_bronze, committer_silver].each do |name|+ Badge.find_by(name: name).update!(enabled: true)+ end++ DiscourseGithubPlugin::GithubBadges.grant!+ users.each(&:reload)++ expect(merge_commit_user.badges).to eq([])+ [bronze_user, bronze_user_repo_2].each_with_index do |u, ind|+ expect(u.badges.pluck(:name)).to eq([committer_bronze])+ end+ expect(contributor.badges.pluck(:name)).to eq([contributor_bronze])+ expect(private_email_contributor.badges.pluck(:name)).to eq([contributor_bronze])+ expect(private_email_contributor2.badges.pluck(:name)).to eq([contributor_bronze])+ expect(silver_user.badges.pluck(:name)).to contain_exactly(committer_bronze, committer_silver)++ # does not grant badges to staged users+ expect(staged_user.badges.first).to eq(nil)+ end++ it "does not update user title if badge is not allowed to be used as a title" do+ DiscourseGithubPlugin::GithubBadges.grant!+ silver_committer_badge =+ Badge.find_by(name: DiscourseGithubPlugin::GithubBadges::COMMITTER_BADGE_NAME_SILVER)++ silver_committer_badge.update!(enabled: true)+ DiscourseGithubPlugin::GithubBadges.grant!+ expect(silver_user.reload.title).to eq(nil)++ silver_committer_badge.update!(allow_title: true)+ DiscourseGithubPlugin::GithubBadges.grant!+ expect(silver_user.reload.title).to eq(silver_committer_badge.name)+ end++ it "updates existing badges" do+ badge = Badge.create!(name: "Great contributor", badge_type_id: 2)+ DiscourseGithubPlugin::GithubBadges.contributor_badges++ expect(badge.reload.name).to eq("Great Contributor")+ end+ end+enddiff --git a/plugins/discourse-github/spec/lib/github_linkback_access_token_setting_validator_spec.rb b/plugins/discourse-github/spec/lib/github_linkback_access_token_setting_validator_spec.rbnew file mode 100644index 00000000000..0910b705265--- /dev/null+++ b/plugins/discourse-github/spec/lib/github_linkback_access_token_setting_validator_spec.rb@@ -0,0 +1,46 @@+# frozen_string_literal: true++require "rails_helper"++describe GithubLinkbackAccessTokenSettingValidator do+ subject(:validator) { described_class.new }++ let(:value) { SecureRandom.hex(10) }++ before { enable_current_plugin }++ describe "#valid_value?" do+ context "when an Octokit::Unauthorized error is raised, meaning the access token cannot access a repo" do+ before do+ setup_repos+ Octokit::Client.any_instance.expects(:branches).raises(Octokit::Unauthorized)+ end++ it "should fail" do+ expect(validator.valid_value?(value)).to eq(false)+ end+ end++ context "when no Octokit::Unauthorized error is raised" do+ it "should pass, without repos defined" do+ expect(validator.valid_value?(value)).to eq(true)+ end++ context "when there are repos defined" do+ before do+ setup_repos+ Octokit::Client.any_instance.expects(:branches).returns([])+ end++ it "should pass if all the repos are accessible" do+ expect(validator.valid_value?(value)).to eq(true)+ end+ end+ end+ end++ def setup_repos+ SiteSetting.github_badges_repos = "discourse/discourse"+ DiscourseGithubPlugin::GithubRepo.repos+ end+enddiff --git a/plugins/discourse-github/spec/lib/github_linkback_spec.rb b/plugins/discourse-github/spec/lib/github_linkback_spec.rbnew file mode 100644index 00000000000..5670ed851dd--- /dev/null+++ b/plugins/discourse-github/spec/lib/github_linkback_spec.rb@@ -0,0 +1,249 @@+# frozen_string_literal: true++require "rails_helper"++describe GithubLinkback do+ let(:github_commit_link) do+ "https://github.com/discourse/discourse/commit/76981605fa10975e2e7af457e2f6a31909e0c811"+ end+ let(:github_commit_link_with_anchor) { "#{github_commit_link}#anchor" }+ let(:github_issue_link) { "https://github.com/discourse/discourse/issues/123" }+ let(:github_pr_link) { "https://github.com/discourse/discourse/pull/701" }+ let(:github_pr_files_link) { "https://github.com/discourse/discourse/pull/701/files" }+ let(:github_pr_link_wildcard) { "https://github.com/discourse/discourse-github-linkback/pull/3" }++ let(:post) { Fabricate(:post, raw: <<~RAW) }+ cool post++ #{github_commit_link}++ https://eviltrout.com/not-a-gh-link++ #{github_commit_link}++ #{github_commit_link_with_anchor}++ https://github.com/eviltrout/tis-100/commit/e22b23f354e3a1c31bc7ad37a6a309fd6daf18f4++ #{github_issue_link}++ #{github_pr_link}++ #{github_pr_files_link}++ i have no idea what i'm linking back to++ #{github_pr_link_wildcard}++ end_of_transmission++ RAW++ before { enable_current_plugin }++ describe "#should_enqueue?" do+ let(:post_without_link) { Fabricate.build(:post, raw: "Hello github!") }+ let(:small_action_post) do+ Fabricate.build(+ :post,+ post_type: Post.types[:small_action],+ raw:+ "https://github.com/discourse/discourse/commit/5be9bee2307dd517c26e6ef269471aceba5d5acf",+ )+ end+ let(:post_with_link) do+ Fabricate.build(+ :post,+ raw:+ "https://github.com/discourse/discourse/commit/5be9bee2307dd517c26e6ef269471aceba5d5acf",+ )+ end++ it "returns false when the feature is disabled" do+ SiteSetting.github_linkback_enabled = false+ expect(GithubLinkback.new(post_with_link).should_enqueue?).to eq(false)+ end++ it "returns false without a post" do+ SiteSetting.github_linkback_enabled = true+ expect(GithubLinkback.new(nil).should_enqueue?).to eq(false)+ end++ it "returns false if the post is not a regular post" do+ SiteSetting.github_linkback_enabled = true+ expect(GithubLinkback.new(small_action_post).should_enqueue?).to eq(false)+ end++ it "returns false when the post doesn't have the `github.com` in it" do+ SiteSetting.github_linkback_enabled = true+ expect(GithubLinkback.new(post_without_link).should_enqueue?).to eq(false)+ end++ it "returns true when the feature is enabled" do+ SiteSetting.github_linkback_enabled = true+ expect(GithubLinkback.new(post_with_link).should_enqueue?).to eq(true)+ end++ describe "private_message" do+ it "doesn't enqueue private messages" do+ SiteSetting.github_linkback_enabled = true+ private_topic = Fabricate(:private_message_topic)+ private_post =+ Fabricate(+ :post,+ topic: private_topic,+ raw: "this post http://github.com should not enqueue",+ )+ expect(GithubLinkback.new(private_post).should_enqueue?).to eq(false)+ end+ end++ describe "unlisted topics" do+ it "doesn't enqueue unlisted topics" do+ SiteSetting.github_linkback_enabled = true+ unlisted_topic = Fabricate(:topic, visible: false)+ unlisted_post =+ Fabricate(+ :post,+ topic: unlisted_topic,+ raw: "this post http://github.com should not enqueue",+ )+ expect(GithubLinkback.new(unlisted_post).should_enqueue?).to eq(false)+ end+ end+ end++ describe "#github_links" do+ it "returns an empty array with no projects" do+ SiteSetting.github_linkback_projects = ""+ links = GithubLinkback.new(post).github_links+ expect(links).to eq([])+ end++ it "doesn't return links that have already been posted" do+ SiteSetting.github_linkback_projects =+ "discourse/discourse|eviltrout/ember-performance|discourse/*"++ post.custom_fields[GithubLinkback.field_for(github_commit_link)] = "true"+ post.custom_fields[GithubLinkback.field_for(github_issue_link)] = "true"+ post.custom_fields[GithubLinkback.field_for(github_pr_link)] = "true"+ post.custom_fields[GithubLinkback.field_for(github_pr_link_wildcard)] = "true"+ post.save_custom_fields++ links = GithubLinkback.new(post).github_links+ expect(links.size).to eq(0)+ end++ it "should return the urls for the selected projects" do+ SiteSetting.github_linkback_projects =+ "discourse/discourse|eviltrout/ember-performance|discourse/*"+ links = GithubLinkback.new(post).github_links+ expect(links.size).to eq(4)++ expect(links[0].url).to eq(github_commit_link)+ expect(links[0].project).to eq("discourse/discourse")+ expect(links[0].sha).to eq("76981605fa10975e2e7af457e2f6a31909e0c811")+ expect(links[0].type).to eq(:commit)++ expect(links[1].url).to eq(github_issue_link)+ expect(links[1].project).to eq("discourse/discourse")+ expect(links[1].issue_number).to eq(123)+ expect(links[1].type).to eq(:issue)++ expect(links[2].url).to eq(github_pr_link)+ expect(links[2].project).to eq("discourse/discourse")+ expect(links[2].pr_number).to eq(701)+ expect(links[2].type).to eq(:pr)++ expect(links[3].url).to eq(github_pr_link_wildcard)+ expect(links[3].project).to eq("discourse/discourse-github-linkback")+ expect(links[3].pr_number).to eq(3)+ expect(links[3].type).to eq(:pr)+ end+ end++ describe "#create" do+ before { SiteSetting.github_linkback_projects = "discourse/discourse|discourse/*" }++ it "returns an empty array without an access token" do+ expect(GithubLinkback.new(post).create).to be_blank+ end++ context "with an access token" do+ let(:headers) do+ {+ "Authorization" => "token abcdef",+ "Content-Type" => "application/json",+ "Host" => "api.github.com",+ "User-Agent" => "Discourse-Github-Linkback",+ }+ end++ before do+ SiteSetting.github_linkback_access_token = "abcdef"++ stub_request(+ :post,+ "https://api.github.com/repos/discourse/discourse/commits/76981605fa10975e2e7af457e2f6a31909e0c811/comments",+ ).with(headers: headers).to_return(status: 200, body: "", headers: {})++ stub_request(+ :post,+ "https://api.github.com/repos/discourse/discourse/issues/123/comments",+ ).with(headers: headers).to_return(status: 200, body: "", headers: {})++ stub_request(+ :post,+ "https://api.github.com/repos/discourse/discourse/issues/701/comments",+ ).with(headers: headers).to_return(status: 200, body: "", headers: {})++ stub_request(+ :post,+ "https://api.github.com/repos/discourse/discourse-github-linkback/issues/3/comments",+ ).with(headers: headers).to_return(status: 200, body: "", headers: {})+ end++ it "returns the URLs it linked to and creates custom fields" do+ links = GithubLinkback.new(post).create+ expect(links.size).to eq(4)++ expect(links[0].url).to eq(github_commit_link)+ field = GithubLinkback.field_for(github_commit_link)+ expect(post.custom_fields[field]).to be_present++ expect(links[1].url).to eq(github_issue_link)+ field = GithubLinkback.field_for(github_issue_link)+ expect(post.custom_fields[field]).to be_present++ expect(links[2].url).to eq(github_pr_link)+ field = GithubLinkback.field_for(github_pr_link)+ expect(post.custom_fields[field]).to be_present++ expect(links[3].url).to eq(github_pr_link_wildcard)+ field = GithubLinkback.field_for(github_pr_link_wildcard)+ expect(post.custom_fields[field]).to be_present+ end++ it "should create linkback for <= SiteSetting.github_linkback_maximum_links urls" do+ SiteSetting.github_linkback_maximum_links = 2+ post = Fabricate(:post, raw: "#{github_pr_link} #{github_issue_link}")+ links = GithubLinkback.new(post).create+ expect(links.size).to eq(2)+ end++ it "should skip linkback for > SiteSetting.github_linkback_maximum_links urls" do+ SiteSetting.github_linkback_maximum_links = 1+ post = Fabricate(:post, raw: "#{github_pr_link} #{github_issue_link}")+ links = GithubLinkback.new(post).create+ expect(links.size).to eq(0)+ end++ it "should create linkback for <= SiteSetting.github_linkback_maximum_links unique urls" do+ SiteSetting.github_linkback_maximum_links = 1+ post = Fabricate(:post, raw: "#{github_pr_link} #{github_pr_link} #{github_pr_link}")+ links = GithubLinkback.new(post).create+ expect(links.size).to eq(1)+ end+ end+ end+enddiff --git a/plugins/discourse-github/spec/lib/github_permalinks_spec.rb b/plugins/discourse-github/spec/lib/github_permalinks_spec.rbnew file mode 100644index 00000000000..9d0af6b7111--- /dev/null+++ b/plugins/discourse-github/spec/lib/github_permalinks_spec.rb@@ -0,0 +1,44 @@+# frozen_string_literal: true++require "rails_helper"++describe GithubPermalinks do+ before { enable_current_plugin }++ context "when it doesn't contain github link to the file" do+ let(:post) { Fabricate(:post, raw: "there is no github link") }++ it "it does not run the job" do+ Jobs.expects(:cancel_scheduled_job).never+ GithubPermalinks.replace_github_non_permalinks(post)+ end+ end++ context "when it contains github link" do+ let(:post) do+ Fabricate(+ :post,+ raw: "https://github.com/discourse/onebox/blob/master/lib/onebox/engine/gfycat_onebox.rb",+ )+ end++ it "ensures only one job is scheduled right after the editing_grace_period" do+ freeze_time++ Jobs+ .expects(:cancel_scheduled_job)+ .with(:replace_github_non_permalinks, post_id: post.id)+ .once+ delay = SiteSetting.editing_grace_period + 1++ expect_enqueued_with(+ job: :replace_github_non_permalinks,+ args: {+ post_id: post.id,+ bypass_bump: false,+ },+ at: Time.zone.now + delay,+ ) { GithubPermalinks.replace_github_non_permalinks(post) }+ end+ end+enddiff --git a/plugins/discourse-github/spec/models/github_repo_spec.rb b/plugins/discourse-github/spec/models/github_repo_spec.rbnew file mode 100644index 00000000000..ee1c503fdef--- /dev/null+++ b/plugins/discourse-github/spec/models/github_repo_spec.rb@@ -0,0 +1,29 @@+# frozen_string_literal: true++require "rails_helper"++describe DiscourseGithubPlugin::GithubRepo do+ before { enable_current_plugin }++ it "strips .git from url" do+ SiteSetting.github_badges_repos = "https://github.com/discourse/discourse.git"+ repo = DiscourseGithubPlugin::GithubRepo.repos.first+ expect(repo.name).to eq("discourse/discourse")+ end++ it "strips trailing slash from url" do+ SiteSetting.github_badges_repos = "https://github.com/discourse/discourse/"+ repo = DiscourseGithubPlugin::GithubRepo.repos.first+ expect(repo.name).to eq("discourse/discourse")+ end++ it "doesn't raise an error when the site setting follows the user/repo format" do+ SiteSetting.github_badges_repos = "discourse/discourse-github"+ repo = DiscourseGithubPlugin::GithubRepo.repos.first+ expect(repo.name).to eq("discourse/discourse-github")++ SiteSetting.github_badges_repos = "discourse/somerepo_with-numbers7"+ repo = DiscourseGithubPlugin::GithubRepo.repos.first+ expect(repo.name).to eq("discourse/somerepo_with-numbers7")+ end+enddiff --git a/plugins/discourse-github/spec/system/core_features_spec.rb b/plugins/discourse-github/spec/system/core_features_spec.rbnew file mode 100644index 00000000000..db86db283bd--- /dev/null+++ b/plugins/discourse-github/spec/system/core_features_spec.rb@@ -0,0 +1,7 @@+# frozen_string_literal: true++RSpec.describe "Core features", type: :system do+ before { enable_current_plugin }++ it_behaves_like "having working core features"+enddiff --git a/translator.yml b/translator.ymlindex b6eadf03b46..fa8abaddd14 100644--- a/translator.yml+++ b/translator.yml@@ -253,3 +253,10 @@ files:- source_path: plugins/discourse-policy/config/locales/server.en.ymldestination_path: plugins/policy/server.ymllabel: policy++ - source_path: plugins/discourse-github/config/locales/client.en.yml+ destination_path: plugins/github/client.yml+ label: github+ - source_path: plugins/discourse-github/config/locales/server.en.yml+ destination_path: plugins/github/server.yml+ label: github