fix
This commit is contained in:
parent
7b4d73a9db
commit
6f0311f20f
26
.github/workflows/assign-to-project.yml
vendored
26
.github/workflows/assign-to-project.yml
vendored
|
@ -34,18 +34,28 @@ jobs:
|
||||||
const project_name = 'test-project'
|
const project_name = 'test-project'
|
||||||
const column_name = 'To do'
|
const column_name = 'To do'
|
||||||
|
|
||||||
|
function firstOrDefault(items, predicate) {
|
||||||
|
for (const item of items) {
|
||||||
|
if (predicate(item)) {
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
// find the project
|
// find the project
|
||||||
const projects = await github.projects.listForRepo({
|
const projects = await github.projects.listForRepo({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
})
|
})
|
||||||
var project = null
|
const project = firstOrDefault(projects, (x) => x.name === project_name)
|
||||||
for (const p of projects) {
|
//var project = null
|
||||||
if (p.name === project_name) {
|
//for (const p of projects) {
|
||||||
project = p
|
// if (p.name === project_name) {
|
||||||
}
|
// project = p
|
||||||
}
|
// }
|
||||||
if (p === null) {
|
//}
|
||||||
|
if (project === null) {
|
||||||
core.setFailed(`Failed to find project "${project_name}".`)
|
core.setFailed(`Failed to find project "${project_name}".`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -60,7 +70,7 @@ jobs:
|
||||||
column = c
|
column = c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c === null) {
|
if (column === null) {
|
||||||
core.setFailed(`Failed to find column "${column_name}" in project ${project.name}.`)
|
core.setFailed(`Failed to find column "${column_name}" in project ${project.name}.`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user