File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export default {
2929 useLowerCaseLabels : true ,
3030 } ,
3131 transfer : {
32+ description : true ,
3233 milestones : true ,
3334 labels : true ,
3435 issues : true ,
Original file line number Diff line number Diff line change @@ -205,6 +205,20 @@ export default class GithubHelper {
205205 ******************************************************************************
206206 */
207207
208+ /**
209+ * Update the description of the repository on GitHub.
210+ * Replaces newlines and tabs with spaces. No attempt is made to remove e.g. Markdown
211+ * links or other special formatting.
212+ */
213+ async updateRepositoryDescription ( description ) {
214+ let props : RestEndpointMethodTypes [ "repos" ] [ "update" ] [ "parameters" ] = {
215+ owner : this . githubOwner ,
216+ repo : this . githubRepo ,
217+ description : description . replace ( / \s + / g, " " )
218+ }
219+ return this . githubApi . repos . update ( props ) ;
220+ }
221+
208222 /**
209223 * TODO description
210224 */
Original file line number Diff line number Diff line change @@ -127,6 +127,11 @@ async function migrate() {
127127
128128 await githubHelper . registerRepoId ( ) ;
129129
130+ // transfer GitLab description to GitHub
131+ if ( settings . transfer . description ) {
132+ await transferDescription ( ) ;
133+ }
134+
130135 // transfer GitLab milestones to GitHub
131136 if ( settings . transfer . milestones ) {
132137 await transferMilestones ( ) ;
@@ -159,6 +164,22 @@ async function migrate() {
159164
160165// ----------------------------------------------------------------------------
161166
167+ /**
168+ * Transfer the description of the repository.
169+ */
170+ async function transferDescription ( ) {
171+ inform ( 'Transferring Description' ) ;
172+
173+ // Get the description of this project
174+ let project = await gitlabApi . Projects . show (
175+ settings . gitlab . projectId
176+ ) as any ;
177+
178+ await githubHelper . updateRepositoryDescription ( project . description ) ;
179+ }
180+
181+ // ----------------------------------------------------------------------------
182+
162183/**
163184 * Transfer any milestones that exist in GitLab that do not exist in GitHub.
164185 */
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