From 23c8058742e25a141e43f423d18b8e79546d95e9 Mon Sep 17 00:00:00 2001 From: Nadia Santalla Date: Fri, 15 Nov 2024 16:30:23 +0100 Subject: [PATCH] self-validate: allow to define config file as an input --- .github/workflows/renovate-validate.yaml | 25 ++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/renovate-validate.yaml b/.github/workflows/renovate-validate.yaml index 6b87ad3..61dd5d9 100644 --- a/.github/workflows/renovate-validate.yaml +++ b/.github/workflows/renovate-validate.yaml @@ -1,5 +1,13 @@ name: Validate renovate config -on: workflow_call +on: + workflow_call: + inputs: + config: + required: false + type: string + default: "" + description: |- + Space-separated list of configs to validate. If empty (recommended), renovate find the config for you. jobs: validate: @@ -12,4 +20,17 @@ jobs: run: | # Renovate updates the line below. Please keep its formatting as it is. RENOVATE_IMAGE=ghcr.io/renovatebot/renovate:39.17.0@sha256:89ad65038d8898af0f9deb09aec3377396d603e19a4573a844e70c23ddafd954 - docker run -i --rm -v "$(realpath .):/repo" -w /repo --entrypoint renovate-config-validator "$RENOVATE_IMAGE" --strict + if [[ -z "${{ inputs.config }}" ]]; then + docker run -i --rm -v "$(realpath .):/repo" -w /repo --entrypoint renovate-config-validator "$RENOVATE_IMAGE" --strict + exit 0 + fi + + success="true" + for c in "${{ inputs.config }}"; do + if ! docker run -i --rm -v "$(realpath .):/repo" -w /repo --entrypoint renovate-config-validator "$RENOVATE_IMAGE" --strict "$c"; then + echo "::error file=$c,title=Validation failed::Config file did not pass validation" + success="false" + fi + done + + [[ "$success" = "true" ]]