This commit is contained in:
Stephan 2021-12-20 19:16:22 +01:00
parent 0132417d3a
commit e902f2afac

View File

@ -80,21 +80,22 @@ jobs:
// determine content type // determine content type
console.log('determine content type...') console.log('determine content type...')
console.log(context) console.log(context) // tons of things
console.log(context.issue) console.log(context.issue) // { owner: 'zpqrtbnk', repo: 'test-repo', number: 85 }
const event_name = context.eventName const event_name = context.eventName
var content_type = null var content_type = null
var item_number = null var item_number = null
var item_id = null var item_id = null
if (event_name === 'issues') { if (event_name === 'issues') {
content_type = 'Issue' content_type = 'Issue'
// FIXME uh?
item_number = context.issue.number item_number = context.issue.number
item_id = context.issue.id item_id = context.issue.id
} }
if (event_name === 'pull_request' || event_name === 'pull_request_target') { if (event_name === 'pull_request' || event_name === 'pull_request_target') {
content_type = 'PullRequest' content_type = 'PullRequest'
item_number = context.pull_request.number item_number = context.payload.pull_request.number
item_id = context.pull_request.id item_id = context.payload.pull_request.id
} }
if (!content_type) { if (!content_type) {
core.setFailed(`Unexpected event name "${event_name}".`) core.setFailed(`Unexpected event name "${event_name}".`)
@ -112,16 +113,16 @@ jobs:
issue_number: item_number issue_number: item_number
}) })
if (!item) { if (!item) {
core.setFailed(`Failed to get issue ${context.issue.number}.`) core.setFailed(`Failed to get item ${item_number}.`)
return return
} }
else { else {
console.log(`${content_type} #${context.issue.number} id: ${item.data.id}.`) console.log(`${content_type} #${item_number} id: ${item.data.id}.`)
console.log(`was: ${item_id} and match?!`) console.log(`was: ${item_id} and match?!`)
} }
console.log('create the card...') console.log('create the card...')
console.log(`in column ${column.id} for item ${item.data.id} of type ${content_type}`) console.log(`in column ${column.id} for item ${item_id} of type ${content_type}`)
await github.projects.createCard({ await github.projects.createCard({
column_id: column.id, column_id: column.id,
//note:, //note:,