From c26fc558a8ddf6c8884146a179e55e42f34999a4 Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 10 Jan 2022 19:21:00 +0100 Subject: [PATCH] fix --- .github/workflows/assign-milestones.js | 100 +------------------------ 1 file changed, 1 insertion(+), 99 deletions(-) diff --git a/.github/workflows/assign-milestones.js b/.github/workflows/assign-milestones.js index 2f467d5..17b5812 100644 --- a/.github/workflows/assign-milestones.js +++ b/.github/workflows/assign-milestones.js @@ -96,7 +96,7 @@ module.exports = async ({github, context, core}) => { } request[isIssue ? 'issue_number' : 'pull_number'] = itemNumber - const itemResponse = await itemApi.get(itemRequest) + const itemResponse = await itemApi.get(request) const item = itemResponse.data console.log(item) const itemId = item.id @@ -152,103 +152,5 @@ module.exports = async ({github, context, core}) => { else { console.log(`nothing to do for evet action ${eventAction}`) } - - /* - - // get and validate the card - const cardMeh = context.action.card_number - - // get and validate the project - - // get and validate the card item - - // - if (eventAction == 'deleted') { - - } - - //const project_name = 'The API Team Board' - - const project_name = 'test-project' - - function firstOrDefault(items, predicate) { - for (const item of items) { - if (predicate(item)) { - return item - } - } - return null - } - - // find the card - // find the type: issue, PR, note - // if issue or PR - // find corresponding milestone - // created if needed - // assign milestone - // madness - this is the only way we can explore context ?! - console.log(context); - console.log(context.payload); - return; - - // find the project - console.log('find project...') - const projects = await restapi.projects.listForRepo({ - owner: context.repo.owner, - repo: context.repo.repo - }) - console.log(`retrieved ${projects.data.length} projects.`) - const project = firstOrDefault(projects.data, (x) => x.name === project_name) - if (!project) { - core.setFailed(`Failed to find project "${project_name}".`) - return - } - else { - console.log(`project id: ${project.id}.`) - } - - // determine content type - console.log('determine content type...') - const event_name = context.eventName - var content_type = null - if (event_name === 'issues') { - content_type = 'Issue' - } - if (event_name === 'pull_request') { - content_type = 'PullRequest' - } - if (!content_type) { - core.setFailed(`Unexpected event name "${event_name}".`) - return - } - else { - console.log(`content type: ${content_type}.`) - } - - // get the issue/pr - console.log('get the issue/pr...') - const item = await restapi.issues.get({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number - }) - if (!item) { - core.setFailed(`Failed to get issue ${context.issue.number}.`) - return - } - else { - console.log(`issue id: ${item.data.id}.`) - } - - console.log('create the card...') - console.log(`in column ${column.id} for item ${item.data.id} of type ${content_type}`) - await restapi.projects.createCard({ - column_id: column.id, - //note:, - content_id: item.data.id, - content_type: content_type - }) - console.log('created') - */ }