1
0
This commit is contained in:
Stephan 2021-12-20 19:07:11 +01:00
parent 02c3f02a25
commit af84310aa0

View File

@ -82,11 +82,17 @@ jobs:
console.log('determine content type...')
const event_name = context.eventName
var content_type = null
var item_number = null
var item_id = null
if (event_name === 'issues') {
content_type = 'Issue'
item_number = context.issue.number
item_id = context.issue.id
}
if (event_name === 'pull_request_target') {
content_type = 'PullRequest'
item_number = context.pull_request.number
item_id = context.pull_request.id
}
if (!content_type) {
core.setFailed(`Unexpected event name "${event_name}".`)
@ -99,13 +105,10 @@ jobs:
// get the item
console.log('get the item...')
console.log(context)
console.log(context.issue)
console.log(context.pull_request)
console.log(context.issue())
const item = await github.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
issue_number: item_number
})
if (!item) {
core.setFailed(`Failed to get issue ${context.issue.number}.`)
@ -113,6 +116,7 @@ jobs:
}
else {
console.log(`${content_type} #${context.issue.number} id: ${item.data.id}.`)
console.log(`was: ${item_id} and match?!`)
}
console.log('create the card...')
@ -120,7 +124,7 @@ jobs:
await github.projects.createCard({
column_id: column.id,
//note:,
content_id: item.data.id,
content_id: item_id,
content_type: content_type
})
console.log('created')