Skip to content

Check constants passed to arguments of fromJSON calls are valid as JSON #464

@rhysd

Description

@rhysd

I noticed that it is popular to pass a string constant to fromJSON() to create an immediate array/object value. Here is a simple example:

on: push

jobs:
  test:
    runs-on: ubuntu-latest
    if: ${{ contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref) }}
    steps:
      - run: echo hello

It would be nice to check the string literals are valid as JSON.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions