File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export default {
3131 useLowerCaseLabels : true ,
3232 } ,
3333 transfer : {
34+ description : true ,
3435 milestones : true ,
3536 labels : true ,
3637 issues : true ,
Original file line number Diff line number Diff line change @@ -292,6 +292,20 @@ export class GithubHelper {
292292 ( author . username === settings . github . token_owner ) ) ;
293293 }
294294
295+ /**
296+ * Update the description of the repository on GitHub.
297+ * Replaces newlines and tabs with spaces. No attempt is made to remove e.g. Markdown
298+ * links or other special formatting.
299+ */
300+ async updateRepositoryDescription ( description ) {
301+ let props : RestEndpointMethodTypes [ "repos" ] [ "update" ] [ "parameters" ] = {
302+ owner : this . githubOwner ,
303+ repo : this . githubRepo ,
304+ description : description . replace ( / \s + / g, " " )
305+ }
306+ return this . githubApi . repos . update ( props ) ;
307+ }
308+
295309 /**
296310 * TODO description
297311 * @param milestones All GitHub milestones
Original file line number Diff line number Diff line change @@ -151,6 +151,11 @@ async function migrate() {
151151 await githubHelper . registerRepoId ( ) ;
152152 await gitlabHelper . registerProjectPath ( settings . gitlab . projectId ) ;
153153
154+ // transfer GitLab description to GitHub
155+ if ( settings . transfer . description ) {
156+ await transferDescription ( ) ;
157+ }
158+
154159 // transfer GitLab milestones to GitHub
155160 if ( settings . transfer . milestones ) {
156161 await transferMilestones ( ) ;
@@ -190,6 +195,22 @@ async function migrate() {
190195
191196// ----------------------------------------------------------------------------
192197
198+ /**
199+ * Transfer the description of the repository.
200+ */
201+ async function transferDescription ( ) {
202+ inform ( 'Transferring Description' ) ;
203+
204+ // Get the description of this project
205+ let project = await gitlabApi . Projects . show (
206+ settings . gitlab . projectId
207+ ) as any ;
208+
209+ await githubHelper . updateRepositoryDescription ( project . description ) ;
210+ }
211+
212+ // ----------------------------------------------------------------------------
213+
193214/**
194215 * Transfer any milestones that exist in GitLab that do not exist in GitHub.
195216 */
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export default interface Settings {
1212 useLowerCaseLabels : boolean ;
1313 } ;
1414 transfer : {
15+ description : boolean ;
1516 milestones : boolean ;
1617 labels : boolean ;
1718 issues : boolean ;
You can’t perform that action at this time.
0 commit comments