Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
3c0a713a
Commit
3c0a713a
authored
Apr 19, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import Github releases
parent
3aa89795
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
lib/github/import.rb
lib/github/import.rb
+27
-0
lib/github/representation/release.rb
lib/github/representation/release.rb
+17
-0
No files found.
lib/github/import.rb
View file @
3c0a713a
...
...
@@ -255,6 +255,33 @@ module Github
end
end
def
fetch_releases
url
=
"/repos/
#{
repo
}
/releases"
while
url
response
=
Github
::
Client
.
new
(
options
).
get
(
url
)
response
.
body
.
each
do
|
raw
|
representation
=
Github
::
Representation
::
Release
.
new
(
raw
)
next
unless
representation
.
valid?
release
=
::
Release
.
find_or_initialize_by
(
project_id:
project
.
id
,
tag:
representation
.
tag
)
next
unless
relese
.
new_record?
begin
release
.
description
=
representation
.
description
release
.
created_at
=
representation
.
created_at
release
.
updated_at
=
representation
.
updated_at
release
.
save!
(
validate:
false
)
rescue
=>
e
error
(
:release
,
representation
.
url
,
e
.
message
)
end
end
url
=
response
.
rels
[
:next
]
end
end
def
restore_source_branch
(
pull_request
)
repository
.
create_branch
(
pull_request
.
source_branch_name
,
pull_request
.
source_branch_sha
)
end
...
...
lib/github/representation/release.rb
0 → 100644
View file @
3c0a713a
module
Github
module
Representation
class
Release
<
Representation
::
Base
def
description
raw
[
'body'
]
end
def
tag
raw
[
'tag_name'
]
end
def
valid?
!
raw
[
'draft'
]
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment