This repository was archived by the owner on Apr 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command to disable all projects for a given user
- Loading branch information
1 parent
f46c4bd
commit 1f670e3
Showing
3 changed files
with
56 additions
and
10 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
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,26 @@ | ||
const Repository = require('../models/Repository'); | ||
const disableProjectTask = require('./disableProject'); | ||
|
||
/** | ||
* config = { | ||
* logger: { info: Function, error: Function }, | ||
* } | ||
*/ | ||
exports.configure = config => async (owner) => { | ||
config.logger.info(`Disabling all enabled projects for "${owner}"`); | ||
|
||
const disableProject = disableProjectTask.configure(config); | ||
|
||
const repositories = await Repository.find({ | ||
owner, | ||
enabled: true, | ||
}); | ||
|
||
await Promise.all( | ||
repositories.map(async (repository) => { | ||
config.logger.info(`-> disabling "${repository.name}"`); | ||
|
||
await disableProject({ repository }); | ||
}) | ||
); | ||
}; |