Skip to content

Commit

Permalink
feat: add validate-policy-bot-action (#497)
Browse files Browse the repository at this point in the history
* feat: add validate-policy-bot-action

* add poly-bot rules

* update description

* remove policy bot config validation for this repo

* update action readme

* add inputs docs to the readme
  • Loading branch information
Elfo404 authored Nov 11, 2024
1 parent cbdc528 commit 29ab6fb
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
29 changes: 29 additions & 0 deletions actions/validate-policy-bot-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# validate-policy-bot-config

Validates the `.policy.yml` configuration file for [Policy Bot](https://github.com/palantir/policy-bot).
See [https://github.com/palantir/policy-bot?tab=readme-ov-file#configuration](Policy Bots' documentation) for more informations.

## Inputs

- `validation_endpoint`: The endpoint to validate the configuration against. Defaults to `https://policy-bot.grafana.net/api/v1/validate`.

Example workflow:

```yaml
name: validate-policy-bot
on:
pull_request:
paths:
- ".policy.yml"
push:
paths:
- ".policy.yml
jobs:
validate-policy-bot:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate Policy Bot configuration
uses: grafana/shared-workflows/actions/validate-policy-bot-config@main
```
21 changes: 21 additions & 0 deletions actions/validate-policy-bot-config/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Validate Policy Bot Config
description: Validates the Policy Bot configuration file.

inputs:
validation_endpoint:
description: |
Validation API endpoint.
default: https://github-policy-bot.grafana-ops.net/api/validate

runs:
using: composite
steps:
- name: Validate Policy Bot config
shell: bash
run: |
curl \
--silent \
--fail-with-body \
--request PUT \
--upload-file .policy.yml \
${{ inputs.validation_endpoint }}

0 comments on commit 29ab6fb

Please sign in to comment.