# screwdriver-workflow-parser

> Parses and converts pipeline configuration into a workflow

Latest version **6.2.0** (published 2025-06-17) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install screwdriver-workflow-parser
pnpm add screwdriver-workflow-parser
yarn add screwdriver-workflow-parser
bun add screwdriver-workflow-parser
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.2.0 |
| Published | 2025-06-17 |
| First published | 2017-10-10 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 25.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Peter Peterson |
| Maintainers | sd-buildbot, petey, d2lam, fenrirunbound, tkyi, stjohnjohnson, minz1027, screwdriver |
| Keywords | screwdriver, yahoo |

## Links

- npm: https://www.npmjs.com/package/screwdriver-workflow-parser
- Repository: https://github.com/screwdriver-cd/workflow-parser
- Issues: https://github.com/screwdriver-cd/screwdriver/issues
- npm.io page: https://npm.io/package/screwdriver-workflow-parser

## Dependencies (2)

- [@hapi/hoek](https://npm.io/package/@hapi/hoek.md) ^11.0.7
- [screwdriver-data-schema](https://npm.io/package/screwdriver-data-schema.md) ^25.0.0

## Recent versions

- 6.2.0 (latest) — 2025-06-17
- 6.1.0 — 2025-04-24
- 6.0.0 — 2025-02-19
- 5.0.1 — 2024-10-10
- 5.0.0 — 2024-08-30
- 4.4.1 — 2024-08-06
- 4.4.0 — 2024-08-02
- 4.3.0 — 2024-03-12
- 4.2.1 — 2024-03-12
- 4.2.0 — 2024-03-07
- 4.1.3 — 2024-02-01
- 4.1.2 — 2024-01-18
- 4.1.1 — 2023-11-08
- 4.1.0 — 2023-09-27
- 4.0.0 — 2022-11-18
- … 35 more at https://npm.io/package/screwdriver-workflow-parser/versions

## README

# Workflow Parser
[![Version][npm-image]][npm-url] ![Downloads][downloads-image] [![Build Status][status-image]][status-url] [![Open Issues][issues-image]][issues-url] ![License][license-image]

> Parses and converts pipeline configuration into a workflow graph

## Usage

```bash
npm install screwdriver-workflow-parser
```

```
const { getWorkflow, getNextJobs, hasCycle } = require('screwdriver-workflow-parser');

// Calculate the directed graph workflow from a pipeline config (and parse legacy workflows)
const workflowGraph = getWorkflow(pipelineConfig, { useLegacy: true });

/* 
{ 
    nodes: [{ name: '~pr'}, { name: '~commit'}, { name: 'main' }], 
    edges: [{ src: '~pr', dest: 'main'}, { src: '~commit', dest: 'main'}] 
}
*/

// Get a list of job names to start as a result of a commit event, e.g. [ 'a', 'b' ]
const commitJobsToTrigger = getNextJobs(workflowGraph, { trigger: '~commit' });

// Get a list of job names to start as a result of a pull-request event, e.g. [ 'PR-123:a' ]
const prJobsToTrigger = getNextJobs(workflowGraph, { trigger: '~pr', prNum: 123 });

// Check to see if a given workflow graph has a loop in it. A -> B -> A
if (hasCycle(workflowGraph)) {
    console.error('Graph contains a loop.');
}
```

## Testing

```bash
npm test
```

## License

Code licensed under the BSD 3-Clause license. See LICENSE file for terms.

[npm-image]: https://img.shields.io/npm/v/screwdriver-workflow-parser.svg
[npm-url]: https://npmjs.org/package/screwdriver-workflow-parser
[downloads-image]: https://img.shields.io/npm/dt/screwdriver-workflow-parser.svg
[license-image]: https://img.shields.io/npm/l/screwdriver-workflow-parser.svg
[issues-image]: https://img.shields.io/github/issues/screwdriver-cd/workflow-parser.svg
[issues-url]: https://github.com/screwdriver-cd/workflow-parser/issues
[status-image]: https://cd.screwdriver.cd/pipelines/529/badge
[status-url]: https://cd.screwdriver.cd/pipelines/529

---
_Source: https://npm.io/package/screwdriver-workflow-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
