# policyer-github

> Policyer provider to validate github sdk calls

Latest version **0.0.5** (published 2021-11-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install policyer-github
pnpm add policyer-github
yarn add policyer-github
bun add policyer-github
```

Provides the command `policyer-github`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2021-11-17 |
| First published | 2021-11-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 32.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Nir Adler |
| Maintainers | niradler55 |
| Keywords | github, actions, policyer |

## Links

- npm: https://www.npmjs.com/package/policyer-github
- npm.io page: https://npm.io/package/policyer-github

## Dependencies (4)

- [policyer](https://npm.io/package/policyer.md) ^0.0.30
- [lodash.get](https://npm.io/package/lodash.get.md) ^4.4.2
- [@actions/core](https://npm.io/package/@actions/core.md) ^1.6.0
- [@actions/github](https://npm.io/package/@actions/github.md) ^5.0.0

## Recent versions

- 0.0.5 (latest) — 2021-11-17
- 0.0.4 — 2021-11-16
- 0.0.3 — 2021-11-14
- 0.0.2 — 2021-11-14
- 0.0.1 — 2021-11-14

## README

# policyer-github

Github provider to test and validate github sdk calls.

[visit policyer repository](https://github.com/niradler/policyer)

## Getting Started

```yaml
# Create checks/validate_branch.yml file
configuration:
  provider: github-provider
  type: github
checks:
  - id: validate-branch-name
    name: check if branch start with Fix-.
    severity: High
    steps:
      - path: env.GITHUB_HEAD_REF
        condition: equal
        value: true
        utility: regex
        utilityProps:
          - "/^FIX-/"
```

```yaml
# Create checks/validate_pr_title.yml file
configuration:
  provider: github-provider
  type: rest
  validEvents:
    - pull_request
  domain: pulls
  action: get
  args:
    owner: context.payload.pull_request.base.user.login
    repo: context.payload.pull_request.base.repo.name
    pull_number: context.payload.pull_request.number
checks:
  - id: validate-pr-title
    name: check if pr title start with FIX.
    severity: High
    steps:
      - path: data.title
        condition: equal
        value: true
        utility: regex
        utilityProps:
          - "/^FIX/i"
```

and add github action:

```yaml
# Add github action file .github/workflows/policyer.yml
name: Policyer

on: [pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Policyer GitHub Action
        uses: policyerorg/policyer-action@v0.0.3-alpha
        with:
          verbose: false
          provider: policyer-github
          internal: false
          checks_path: ./checks
```

Links for github documentation:

- https://docs.github.com/en/rest/reference
- https://octokit.github.io/rest.js/v18

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