Create the label manually

pull/1/head
Jason Etcovitch 4 years ago
parent 5246325919
commit 39de3416e8

@ -2,6 +2,7 @@ require('dotenv').config()
const { Toolkit } = require('actions-toolkit')
const getAuthorNodeId = require('./lib/get-author-id')
const userIsSponsor = require('./lib/user-is-sponsor')
const createLabel = require('./lib/create-label')
const addLabel = require('./lib/add-label')
Toolkit.run(async tools => {
@ -16,6 +17,7 @@ Toolkit.run(async tools => {
}
// Add the label
await createLabel(tools)
await addLabel(tools)
tools.log.success('Label successfully applied. Have a nice day!')
}, {

@ -0,0 +1,17 @@
/**
* Creates the configured label (or the default one). If
* the label already exists, it'll throw and fail silently.
* @param {import('actions-toolkit').Toolkit} tools
*/
module.exports = async function createLabel (tools) {
// Create the label
const label = tools.inputs.label || 'sponsor'
tools.log.debug(`Making label [${label}]`)
try {
return tools.github.issues.createLabel({
...tools.context.repo,
name: label,
color: '#ea4aaa'
})
} catch {}
}
Loading…
Cancel
Save