Π·Π΅ΡΠΊΠ°Π»ΠΎ ΠΈΠ· https://github.com/electron/trop.git
small but nice things π
This commit is contained in:
Π ΠΎΠ΄ΠΈΡΠ΅Π»Ρ
80acd9e86d
ΠΠΎΠΌΠΌΠΈΡ
c3747790c7
19
index.js
19
index.js
|
@ -5,30 +5,19 @@ module.exports = (robot) => {
|
|||
robot.on('push', async context => {
|
||||
const config = await context.config('config.yml')
|
||||
const id = config.watchedProject.id
|
||||
const columns = await context.projects.getProjectColumns({id})
|
||||
|
||||
const data = {
|
||||
owner: context.payload.repository.owner.login,
|
||||
repo: context.payload.repository.name
|
||||
}
|
||||
const columns = await context.projects.getProjectColumns({context.repo(id)})
|
||||
|
||||
// generate labels based on project column names
|
||||
columns.forEach(async column => {
|
||||
// check if label already exists
|
||||
const label = await context.issues.getLabel({
|
||||
owner: data.owner,
|
||||
repo: data.repo,
|
||||
name: column.name
|
||||
})
|
||||
const label = await context.issues.getLabel({context.issue(name: column.name)})
|
||||
|
||||
// if it doesn't exist, create a new label
|
||||
if (label.status === 404) {
|
||||
const newLabel = context.issues.createLabel({
|
||||
owner: data.owner,
|
||||
repo: data.repo,
|
||||
const newLabel = context.issues.createLabel({context.issue(
|
||||
name: column.name,
|
||||
color: randomColor()
|
||||
})
|
||||
)})
|
||||
}
|
||||
})
|
||||
|
||||
|
|
ΠΠ°Π³ΡΡΠ·ΠΊΠ°β¦
Π‘ΡΡΠ»ΠΊΠ° Π² Π½ΠΎΠ²ΠΎΠΉ Π·Π°Π΄Π°ΡΠ΅