Skip to content

Commit

Permalink
feat: add validate-policy-bot-action
Browse files Browse the repository at this point in the history
  • Loading branch information
Elfo404 committed Oct 23, 2024
1 parent 122e100 commit f789601
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/validate-policy-bot-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Validate Policy Bot config

on:
pull_request:
paths:
- .policy.yml
push:
branches:
- main
paths:
- .policy.yml

jobs:
validate-policy-bot-config:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Validate Policy Bot config
uses: ./actions/validate-policy-bot-config
Empty file added .policy.yml
Empty file.
24 changes: 24 additions & 0 deletions actions/validate-policy-bot-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# validate-policy-bot-config

Generate an SPDX SBOM Report and attached to Release Artifcats on Release Publish

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 f789601

Please sign in to comment.