# pra-check

> Check PRA on linked userstory or feature

Latest version **1.0.7** (published 2021-09-21) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install pra-check
pnpm add pra-check
yarn add pra-check
bun add pra-check
```

Provides the command `pra-check`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2021-09-21 |
| First published | 2020-11-27 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 21.7 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | John van Pelt |
| Maintainers | johnvanpelt |

## Links

- npm: https://www.npmjs.com/package/pra-check
- Repository: https://stedinnetbeheer.visualstudio.com/GIT%20SAP%20SO/_git/pra-check
- npm.io page: https://npm.io/package/pra-check

## Dependencies (7)

- [path](https://npm.io/package/path.md) ^0.12.7
- [axios](https://npm.io/package/axios.md) ^0.21.4
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [clear](https://npm.io/package/clear.md) ^0.1.0
- [figlet](https://npm.io/package/figlet.md) ^1.5.2
- [commander](https://npm.io/package/commander.md) ^8.2.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.3

## Recent versions

- 1.0.7 (latest) — 2021-09-21
- 1.0.5 — 2021-09-21
- 1.0.4 — 2021-09-21
- 1.0.3 — 2020-11-27

## README

# PRA Check

This package exposes a CLI that checks if a Pull request has a PRA value available on the linked userstory or it's parent feature. To do these checks
the REST apis of Azure DevOps services are used.

Unfortunately for now it is not possible to call the Azure DevOps apis using a service principal:
[docs](https://docs.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/authentication-guidance?view=azure-devops)

Therefore we will use a PAT (Personal Access Token)
[docs](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page).

The following options are available and required:

| short option | long option | description                          |
| ------------ | ----------- | ------------------------------------ |
| -P           | --project   | Azure DevOps project (name or id)    |
| -p           | --prid      | Azure DevOps PR id                   |
| -r           | --repo      | Azure Devops repository (name or id) |
| -u           | --user      | Stedin user                          |

**In case you will use the project or repository names make sure to escape spaces.**

The last option necessary is the env variable `PAT_TOKEN`. This one is not available to provide using the CLI but must be provided using the
environment.

To use this CLI in a Azure DevOps pipeline follow these steps:

1. Create a PAT for the user you wish to use for the checks. See the MS docs above to generate one.
2. Add a step to your pipeline to install node.js
3. Add a step to use the CLI provided by this package.

There is an example yaml file in the samples folder. As seen there the project / repository and pull request id are taken from the variables available
in the pipeline.

The only variables you need to add are `PAT_USER` and `PAT_TOKEN`. The `PAT_USER` can be maintained in the pipeline or in code.
[docs](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#set-variables-in-pipeline)

For the `PAT_TOKEN` it would be a bad practice to have it in code as it will no longer be secret therefore follow these
[instructions](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#secret-variables) or use
a [keyvault](https://docs.microsoft.com/en-us/azure/devops/pipelines/release/azure-key-vault?view=azure-devops)

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