1
0
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:
qwerty287
2023-06-27 18:01:18 +02:00
committed by GitHub
parent b1787f82dc
commit 3033abc3b4
53 changed files with 935 additions and 480 deletions

View File

@@ -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;