Skip to content

v3.3.0 fails in our build pipeline with an "TypeError: data.forEach is not a function" error #86

@edgarvonk

Description

@edgarvonk

Not sure if this is an issue in the json-yaml-validate GitHub action or in our configuration or code base but upgrading to v3.3.0 fails with the following error:

Run GrantBirki/json-yaml-validate@947ae8ac60c83cf78e4e00b3170ff8bee61f5248
  with:
    comment: true
    allow_multiple_documents: true
    yaml_exclude_regex: charts/.+\.ya?ml$
    github_token: ***
    mode: fail
    base_dir: .
    use_dot_match: true
    json_schema_version: draft-07
    json_extension: .json
    use_ajv_formats: true
    yaml_extension: .yaml
    yaml_extension_short: .yml
    yaml_as_json: false
    exclude_file_required: true
    use_gitignore: true
    git_ignore_path: .gitignore
    ajv_strict_mode: true

/home/runner/work/_actions/GrantBirki/json-yaml-validate/947ae8ac60c83cf78e4e00b3170ff8bee61f5[2](https://github.com/infonl/dimpact-zaakafhandelcomponent/actions/runs/14476888345/job/40604567149?pr=3106#step:3:2)48/src/functions/json-validator.js:260
    data.forEach((doc, index) => {
^
TypeError: data.forEach is not a function
    at jsonValidator (/home/runner/work/_actions/GrantBirki/json-yaml-validate/947ae8ac60c8[3](https://github.com/infonl/dimpact-zaakafhandelcomponent/actions/runs/14476888345/job/40604567149?pr=3106#step:3:3)cf78e4e00b3170ff8bee61f52[4](https://github.com/infonl/dimpact-zaakafhandelcomponent/actions/runs/14476888345/job/40604567149?pr=3106#step:3:4)8/src/functions/json-validator.js:260:1)
    at run (/home/runner/work/_actions/GrantBirki/json-yaml-validate/947ae8ac60c83cf78e4e00b3170ff8bee61f[5](https://github.com/infonl/dimpact-zaakafhandelcomponent/actions/runs/14476888345/job/40604567149?pr=3106#step:3:5)248/src/main.js:7:1)

For details see: https://github.com/infonl/dimpact-zaakafhandelcomponent/actions/runs/14488643815/job/40639743793?pr=3106

Our GitHub workflow in question:

# SPDX-FileCopyrightText: 2025 Lifely
# SPDX-License-Identifier: EUPL-1.2+

name: Validate json and yaml files in the repo
on:
  push:
    branches:
      - main
  pull_request:
  merge_group:
  workflow_dispatch:

permissions:
  contents: read
  pull-requests: write # enable write permissions for pull request comments

jobs:
  json-yaml-validate:
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout repository
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

      - name: json-yaml-validate
        id: json-yaml-validate
        uses: GrantBirki/json-yaml-validate@e42e6ece9b97f2b220274c909a9a98e380c2c9fd # v3.2.1
        with:
          comment: true
          allow_multiple_documents: true
          yaml_exclude_regex: "charts/.+\\.ya?ml$" # validation will break on helm charts. We have linting already in place

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions