Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/niradler/policyer-github
Policyer provider to validate Github SDK calls
https://github.com/niradler/policyer-github
action actions github-action github-actions policyer
Last synced: about 1 month ago
JSON representation
Policyer provider to validate Github SDK calls
- Host: GitHub
- URL: https://github.com/niradler/policyer-github
- Owner: niradler
- License: mit
- Created: 2021-11-13T00:19:50.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-05T22:09:18.000Z (about 3 years ago)
- Last Synced: 2023-08-08T01:12:10.525Z (over 1 year ago)
- Topics: action, actions, github-action, github-actions, policyer
- Language: JavaScript
- Homepage:
- Size: 81.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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: Policyeron: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Policyer GitHub Action
uses: policyerorg/[email protected]
with:
verbose: false
provider: policyer-github
internal: false
checks_path: ./checks
```![Workflow](static/action.PNG)
Links for github documentation:
- https://docs.github.com/en/rest/reference
- https://octokit.github.io/rest.js/v18