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