Skip to content

Commit

Permalink
refactor: reduce nesting in github fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
topaxi committed Dec 4, 2024
1 parent 4ec6bc2 commit ff3e5ac
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions lua/pipeline/providers/github/rest/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,19 @@ function GithubRestProvider:dispatch(pipeline)

store.update_state(function(state)
state.error = err and err.message or nil
state.runs = utils.group_by(
function(run)
return run.pipeline_id
end,
utils.uniq(function(run)
return run.run_id
end, {
unpack(runs),
unpack(vim.iter(state.runs):flatten():totable()),
})
)
if not state.error then
state.runs = utils.group_by(
function(run)
return run.pipeline_id
end,
utils.uniq(function(run)
return run.run_id
end, {
unpack(runs),
unpack(vim.iter(state.runs):flatten():totable()),
})
)
end
end)
end,
}
Expand Down

0 comments on commit ff3e5ac

Please sign in to comment.