You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-23 21:44:44 +02:00
Add own workflow model (#1784)
Closes #1287 --------- Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import { Pipeline, PipelineStep, Repo } from '~/lib/api/types';
|
||||
import { Pipeline, PipelineStep, PipelineWorkflow, Repo } from '~/lib/api/types';
|
||||
|
||||
export function findStep(steps: PipelineStep[], pid: number): PipelineStep | undefined {
|
||||
return steps.reduce((prev, step) => {
|
||||
if (step.pid === pid) {
|
||||
return step;
|
||||
}
|
||||
|
||||
if (step.children) {
|
||||
const result = findStep(step.children, pid);
|
||||
if (result) {
|
||||
return result;
|
||||
export function findStep(workflows: PipelineWorkflow[], pid: number): PipelineStep | undefined {
|
||||
return workflows.reduce((prev, workflow) => {
|
||||
const result = workflow.children.reduce((prevChild, step) => {
|
||||
if (step.pid === pid) {
|
||||
return step;
|
||||
}
|
||||
|
||||
return prevChild;
|
||||
}, undefined as PipelineStep | undefined);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return prev;
|
||||
|
||||
Reference in New Issue
Block a user