From ca6366854c4f6cf89108e982332fc77f806e1e78 Mon Sep 17 00:00:00 2001 From: Eivind Grimstad Date: Tue, 12 May 2026 14:42:07 +0200 Subject: [PATCH] feat(ETU-71559): Add input annotations to disable annotations Allowed values: all: Annotate all files that have lint problems none: Dont annotate any files Those are the first supported values, but we hope to support a value "changed_lines" in the future to only annotate the lines that were changed in the pull request. --- .github/workflows/ci.yml | 8 ++++++++ .github/workflows/lint.yml | 22 +++++++++++++++++++++- fixture/openapi-bad.yaml | 5 ++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8b712b..d263cc0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,14 @@ jobs: upload_to_bucket: false fail_threshold: never + test-lint-file-fail-threshold-never-ok-hide-annotations: + uses: ./.github/workflows/lint.yml + with: + path: fixture/openapi-bad.yaml + upload_to_bucket: false + annotations: none + fail_threshold: never + test-validate-file-external-refs: uses: ./.github/workflows/validate.yml with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0d893aa..dd717ab 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,6 +17,11 @@ on: description: "The threshold to fail the build. Accepted values: warn, error, never" type: string default: "never" + annotations: + description: "Annotate files with lint problems. Accepted values: all (annotate all files), none (dont annotate any files)" + type: string + default: all + env: REDOCLY_VERSION: "2.25.1" @@ -32,6 +37,7 @@ jobs: id-token: write env: GHA_API_FAIL_THRESHOLD: ${{ inputs.fail_threshold }} + GHA_API_ANNOTATIONS: ${{ inputs.annotations }} GHA_API_ARTIFACT: ${{ inputs.artifact }} GHA_API_PATH: ${{ inputs.path }} SHOULD_UPLOAD: >- @@ -70,6 +76,16 @@ jobs: exit 1 ;; esac + + # Validate annotations + case "$GHA_API_ANNOTATIONS" in + all|none) + ;; # OK + *) + echo "::error::annotatons must be one of: all, none" + exit 1 + ;; + esac - name: Resolve spec path id: resolve-spec-path run: | @@ -111,6 +127,7 @@ jobs: env: GHA_API_PATH: ${{ steps.resolve-spec-path.outputs.spec_path }} GHA_API_FAIL_THRESHOLD: ${{ inputs.fail_threshold }} + GHA_API_ANNOTATIONS: ${{ inputs.annotations }} run: | set -o errexit set -o nounset @@ -130,7 +147,10 @@ jobs: fi if [ "$rc" -eq 1 ]; then - cat $annotations + if [ "$GHA_API_ANNOTATIONS" = "all" ]; then + cat $annotations + fi + # Truncate to stay under GitHub's 1024k step summary limit. Leave 200 bytes for warning message. max_size=$((1024 * 1024 - 200)) if [ "$(wc -c < "$markdown")" -gt "$max_size" ]; then diff --git a/fixture/openapi-bad.yaml b/fixture/openapi-bad.yaml index 9151fcb..302d24a 100644 --- a/fixture/openapi-bad.yaml +++ b/fixture/openapi-bad.yaml @@ -1 +1,4 @@ -openapi: "3.1.0" \ No newline at end of file +openapi: "3.1.0" +info: + x-entur-metadata: + id: example-id