.gitlab-ci.yml validation error: only config should be an array of strings or regexps

I have a job which uses a valid YAML syntax but when using GitLab’s .gitlab-ci.yml validator or when the pipeline tries to run I get this error:

jobs:My Job:only config should be an array of strings or regexps

Here is the job:

My Job:
    stage: My Stage
    only:
        - merge_requests
        - changes:
            - package.json
            - package-lock.json

I expect no errors for this configuration. I looked trough the documentation but could not find a similar example.

1 Like