-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for fetching/adding/removing labels and adding a comment.
- Loading branch information
Showing
15 changed files
with
553 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/ckeditor5-dev-stale-bot/bin/utils/createspinner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
const ora = require( 'ora' ); | ||
const chalk = require( 'chalk' ); | ||
|
||
/** | ||
* Creates the spinner instance with methods to update spinner text. | ||
* | ||
* @returns {Object} data | ||
* @returns {ora.Ora} data.instance | ||
* @returns {Function} data.printStatus | ||
* @returns {Function} data.onProgressFactory | ||
*/ | ||
module.exports = function createSpinner() { | ||
const instance = ora().start(); | ||
|
||
const printStatus = text => { | ||
instance.text = text; | ||
|
||
if ( !instance.isSpinning ) { | ||
console.log( text ); | ||
} | ||
}; | ||
|
||
const onProgressFactory = () => { | ||
const title = instance.text; | ||
|
||
return ( { done, total } ) => { | ||
const progress = total ? Math.round( ( done / total ) * 100 ) : 0; | ||
const text = `${ title } ${ chalk.bold( `${ progress }%` ) }`; | ||
|
||
printStatus( text ); | ||
}; | ||
}; | ||
|
||
return { | ||
instance, | ||
printStatus, | ||
onProgressFactory | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/ckeditor5-dev-stale-bot/bin/utils/validateconfig.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/** | ||
* Checks if all required fields in the configuration exist. | ||
* | ||
* @param {Config} config Configuration options. | ||
* @returns {Boolean} | ||
*/ | ||
module.exports = function validateConfig( config ) { | ||
if ( !config.REPOSITORY_SLUG ) { | ||
throw new Error( 'Missing configuration option: REPOSITORY_SLUG' ); | ||
} | ||
|
||
if ( !config.STALE_LABELS ) { | ||
throw new Error( 'Missing configuration option: STALE_LABELS' ); | ||
} | ||
|
||
if ( !config.STALE_ISSUE_MESSAGE ) { | ||
throw new Error( 'Missing configuration option: STALE_ISSUE_MESSAGE' ); | ||
} | ||
|
||
if ( !config.STALE_PR_MESSAGE ) { | ||
throw new Error( 'Missing configuration option: STALE_PR_MESSAGE' ); | ||
} | ||
}; |
Oops, something went wrong.