-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CR: check CR with specberus and check approvals with GH API
- Loading branch information
Showing
5 changed files
with
103 additions
and
2 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
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,62 @@ | ||
'use strict'; | ||
|
||
var List = require('immutable').List; | ||
var Octokat = require('octokat'); | ||
|
||
/** | ||
* @exports lib/transition-checker | ||
*/ | ||
|
||
var TransitionChecker = {}; | ||
|
||
/** | ||
* @returns {Promise.<List.<String>>} | ||
*/ | ||
|
||
TransitionChecker.check = function (profile, latestVersion, previousVersion) { | ||
return new Promise(function (resolve, reject) { | ||
var editorial = false; | ||
var errors = new List(); | ||
if (profile === 'WD' || profile === 'WG-NOTE') { | ||
resolve(errors); | ||
} | ||
else if (profile === 'CR') { | ||
if (previousVersion.includes("/WD-") || !editorial) { | ||
var shortname = latestVersion.match(new RegExp(/.*\/([^/]+)\/$/))[1]; | ||
var octo = new Octokat({ | ||
token: "" // TODO: create token | ||
}); | ||
|
||
var shortname = 'css-text-decor-3'; | ||
var repo = octo.repos('w3c', 'transitions'); | ||
var approvalText = "Please update the Re"; | ||
|
||
repo.issues.fetch({ | ||
labels: 'Awaiting publication', | ||
state: 'open', | ||
per_page: 100 | ||
}) | ||
.then((content) => { | ||
for (var issue of content.items) { | ||
if (issue.title.endsWith(' ' + shortname)) { | ||
repo.issues(issue.number).comments.fetch() | ||
.then((comments) => { | ||
for (var comment of comments.items) { | ||
if (comment.body.startsWith(approvalText)) { | ||
// TODO: comment.user.login has approved the transition | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
else { | ||
return reject(new Error('Only WD, CR and Notes are allowed!')); | ||
} | ||
resolve(errors); | ||
}); | ||
}; | ||
|
||
module.exports = TransitionChecker; |
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