-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add validate-policy-bot-action (#497)
* 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
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |