Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added rudimentary gitlab support#657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
kreczko wants to merge29 commits intogithub-changelog-generator:master
base:master
Choose a base branch
Loading
fromkreczko:kreczko-issue-419
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
29 commits
Select commitHold shift + click to select a range
736b772
added gitlab fetcher
kreczkoMay 29, 2018
c2e9ed9
implemented fetch_tags for GITLAB
kreczkoMay 29, 2018
7e6d1e2
first successful runthrough with gitlab_fetcher
kreczkoMay 30, 2018
468a7cb
adjusting generator_fetcher to accept pr["merge_commit_sha"] if avail…
kreczkoMay 30, 2018
df91ce2
added gitlab option
kreczkoMay 30, 2018
8905121
select correct fetcher depending on gitlab option (default github)
kreczkoMay 30, 2018
4f24ec0
restricting gitlab fetcher to closed issues
kreczkoMay 30, 2018
4ef2033
fixed authors in merge_requests for gitlab fetcher
kreczkoMay 30, 2018
18ede11
fixed typo in generator_fetcher
kreczkoMay 30, 2018
86b41c0
fixed issues and associated events in gitlab_fetcher
kreczkoMay 30, 2018
2c261cb
fixed project_id for gitlab_fetcher in the case of forks
kreczkoMay 30, 2018
e696d2c
fixed events for merge requests in gitlab_fetcher
kreczkoMay 30, 2018
16fdb8d
fixed merge_commit_sha for older gitlab versions in gitlab_fetcher
kreczkoMay 30, 2018
d1004f7
separated fetching issues and pull requests as it was causing problem…
kreczkoAug 7, 2018
681c4b4
fix gitlab fetcher for project that have no issues
kreczkoAug 7, 2018
3b5a974
fixed if-logic based on feedback from olleolleolle
kreczkoNov 1, 2018
2a1350f
Github --> Gitlab for GitlabFetcher
kreczkoNov 1, 2018
1de4431
added Gitlab URI example
kreczkoNov 1, 2018
d62e1e1
missing change from Github->Gitlab change: Helper --> GitHubChangelog…
kreczkoNov 1, 2018
d6e257f
CHANGELOG_GITHUB_TOKEN --> CHANGELOG_AUTH_TOKEN for gitlab fetcher
kreczkoNov 1, 2018
264e6ba
fixed RuboCop issues for gitlab_fetcher
kreczkoNov 1, 2018
b13d759
preliminary tests for gitlab_fetcher
kreczkoNov 1, 2018
b1f9d09
added gitlab_changelog_generator
kreczkoNov 1, 2018
0e66b15
Last few Github -> Gitlab conversions
kreczkoNov 1, 2018
182ff69
resolved second batch of feedback from @olleolleolle
kreczkoNov 1, 2018
602a923
Add gitlab to rake task
cdenneenJan 29, 2020
81b1a9a
Merge pull request #1 from cdenneen/patch-1
kreczkoJan 29, 2020
d5fa89b
Merge remote-tracking branch 'upstream/master' into kreczko-issue-419
cdenneenJan 29, 2020
faf358a
Merge pull request #2 from cdenneen/kreczko-issue-419
kreczkoJan 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion.gitignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
bin/
bin/*
!bin/git-generate-changelog
!bin/github_changelog_generator
!bin/gitlab_changelog_generator
pkg/
coverage/
.bundle
Expand Down
5 changes: 5 additions & 0 deletionsbin/gitlab_changelog_generator
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
#! /usr/bin/env ruby
# frozen_string_literal: true

require_relative "../lib/gitlab_changelog_generator"
GitLabChangelogGenerator::ChangelogGenerator.new.run
3 changes: 2 additions & 1 deletionlib/github_changelog_generator/generator/generator.rb
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "github_changelog_generator/octo_fetcher"
require "github_changelog_generator/gitlab_fetcher"
require "github_changelog_generator/generator/generator_fetcher"
require "github_changelog_generator/generator/generator_processor"
require "github_changelog_generator/generator/generator_tags"
Expand DownExpand Up@@ -34,7 +35,7 @@ class Generator
def initialize(options = {})
@options = options
@tag_times_hash = {}
@fetcher = GitHubChangelogGenerator::OctoFetcher.new(options)
@fetcher =options[:gitlab] ? GitLabChangelogGenerator::GitlabFetcher.new(options) :GitHubChangelogGenerator::OctoFetcher.new(options)
@sections = []
end

Expand Down
21 changes: 17 additions & 4 deletionslib/github_changelog_generator/generator/generator_fetcher.rb
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,8 @@ def fetch_events_for_issues_and_pr
print "Fetching events for issues and PR: 0/#{@issues.count + @pull_requests.count}\r" if options[:verbose]

# Async fetching events:
@fetcher.fetch_events_async(@issues + @pull_requests)
@fetcher.fetch_events_async(@issues)
@fetcher.fetch_events_async(@pull_requests)
end

# Async fetching of all tags dates
Expand DownExpand Up@@ -73,9 +74,11 @@ def associate_tagged_prs(tags, prs, total)
# fetch that. See
# https://developer.github.com/v3/pulls/#get-a-single-pull-request vs.
# https://developer.github.com/v3/pulls/#list-pull-requests
if pr["events"] && (event = pr["events"].find { |e| e["event"] == "merged" })
# gitlab API has this
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#gitlabAPIhas this
#Compatibility with GitLabAPI(`pr` can be Merge Request or PR)

GlennM reacted with thumbs up emoji
merge_commit_sha = try_merge_commit_sha_from_gitlab(pr)
if merge_commit_sha
# Iterate tags.reverse (oldest to newest) to find first tag of each PR.
if (oldest_tag = tags.reverse.find { |tag| tag["shas_in_tag"].include?(event["commit_id"]) })
if (oldest_tag = tags.reverse.find { |tag| tag["shas_in_tag"].include?(merge_commit_sha) })
pr["first_occurring_tag"] = oldest_tag["name"]
found = true
i += 1
Expand All@@ -95,6 +98,16 @@ def associate_tagged_prs(tags, prs, total)
end
end

def try_merge_commit_sha_from_gitlab(merge_request)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The naming here has issues:

  • merge_request argument name - it can be a PRor a Merge Request (e.g.pr_or_merge_request is not an ill-descriptive name for that)
  • the method name#try_merge_commit_sha_from_gitlab obscures that italso processes GitHub data

A method name such as#find_merge_commit_for(pr_or_merge_request) would help maintenance of this.

merge_commit_sha = nil
if merge_request.key?("merge_commit_sha")
merge_commit_sha = merge_request["merge_commit_sha"]
elsif merge_request["events"] && (event = merge_request["events"].find { |e| e["event"] == "merged" })
merge_commit_sha = event["commit_id"]
end
merge_commit_sha
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

if is an expression: this can be the whole body.

ifmerge_request.key?("merge_commit_sha")merge_request["merge_commit_sha"]elsifmerge_request["events"] &&(event=merge_request["events"].find{ |e|e["event"] =="merged"})event["commit_id"]end


# Associate merged PRs by the HEAD of the release branch. If no
# --release-branch was specified, then the github default branch is used.
#
Expand DownExpand Up@@ -157,7 +170,7 @@ def associate_rebase_comment_prs(tags, prs_left, total)
# @param [Hash] issue
def find_closed_date_by_commit(issue)
unless issue["events"].nil?
# if it's PR -> then find "merged event", in case of usual issue ->fond closed date
# if it's PR -> then find "merged event", in case of usual issue ->find closed date
compare_string = issue["merged_at"].nil? ? "closed" : "merged"
# reverse! - to find latest closed event. (event goes in date order)
issue["events"].reverse!.each do |event|
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp