From 17476467720e0ab5984f5d825e19c62c5e64d93e Mon Sep 17 00:00:00 2001 From: ouvreboite Date: Fri, 14 Jun 2024 12:07:33 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Automatically=20update=20the=20v?= =?UTF-8?q?alid=20ruleset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/poltergust.yaml | 10 ++++++++++ examples/invalid/spectral.yaml | 19 ------------------- examples/valid/rules1.md | 2 +- 3 files changed, 11 insertions(+), 20 deletions(-) delete mode 100644 examples/invalid/spectral.yaml diff --git a/.github/workflows/poltergust.yaml b/.github/workflows/poltergust.yaml index 7780648..8bc49c0 100644 --- a/.github/workflows/poltergust.yaml +++ b/.github/workflows/poltergust.yaml @@ -8,6 +8,8 @@ on: jobs: build-and-test-valid-example: + permissions: + contents: write runs-on: ubuntu-latest steps: @@ -23,6 +25,14 @@ jobs: - name: Test the valid example ruleset run: npx poltergust ./examples/valid + - name: Commit updated valid ruleset + run: | + git config --global user.name 'poltergust' + git config --global user.email 'poltergust@users.noreply.github.com' + git commit -am "Auto-update valid ruleset" + git push + + build-and-test-invalid-example: needs: build-and-test-valid-example runs-on: ubuntu-latest diff --git a/examples/invalid/spectral.yaml b/examples/invalid/spectral.yaml deleted file mode 100644 index acb0f24..0000000 --- a/examples/invalid/spectral.yaml +++ /dev/null @@ -1,19 +0,0 @@ -formats: ["oas3"] -extends: "spectral:oas" -aliases: - parameters: - - $.paths[*].parameters - - $.paths[*][*].parameters -#rules will be injected from the rules/*.md files -rules: - base-path-must-start-with-slash: - description: Base path must start with /. - message: "{{description}}. But was {{value}}." - given: $.servers[*] - severity: error - then: - field: url - function: pattern - functionOptions: - match: "^\/" - \ No newline at end of file diff --git a/examples/valid/rules1.md b/examples/valid/rules1.md index e66ca83..f43ef96 100644 --- a/examples/valid/rules1.md +++ b/examples/valid/rules1.md @@ -38,7 +38,7 @@ servers: ```yaml #👻-rule base-path-must-start-with-slash: - description: Base path must start with /. + description: Base path must be relative (start with a /) message: "{{description}}. But was {{value}}." given: $.servers[*] severity: error