From 6a00c973fbb94c04ec3659b8fcf158a705772203 Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 10 Jan 2022 18:39:14 +0100 Subject: [PATCH] fix --- .github/workflows/assign-milestones.js | 10 ++++++---- .github/workflows/assign-milestones.yml | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/assign-milestones.js b/.github/workflows/assign-milestones.js index 4b53216..4086597 100644 --- a/.github/workflows/assign-milestones.js +++ b/.github/workflows/assign-milestones.js @@ -13,7 +13,7 @@ // it's move to a project column for the first time - being assigned to the project // and showing in project's backlog is not enough. -module.exports = async ({github, context}) => { +module.exports = async ({github, context, core}) => { const restapi = github.rest @@ -74,7 +74,7 @@ module.exports = async ({github, context}) => { const [ itemType, itemNumber ] = last2(card.content_url) var itemId - if (itemType == 'issue') { + if (itemType == 'issues') { const issueResponse = await restapi.issues.get({ owner: context.owner, repo: context.repo, @@ -93,14 +93,16 @@ module.exports = async ({github, context}) => { itemId = pullResponse.data.id } else { - console.log(`item: ${itemType} ??`) + core.setFailed(`Unsupported item type ${itemType}`) + return } console.log(`item: ${itemType}/${itemId}`) - const milestones = await restapi.issues.listMilestones({ + const milestonesResponse = await restapi.issues.listMilestones({ repo: context.repo, owner: context.owner }) + const milestones = milestonesResponse.data console.log(milestones) /* diff --git a/.github/workflows/assign-milestones.yml b/.github/workflows/assign-milestones.yml index f300639..5ed3337 100644 --- a/.github/workflows/assign-milestones.yml +++ b/.github/workflows/assign-milestones.yml @@ -43,4 +43,4 @@ jobs: // current working directory. const script = require('./.github/workflows/assign-milestones.js') - await script({github, context}) + await script({github, context, core})