在合并请求时运行gitlab-ci.yml/不发生任何情况

在合并请求时运行gitlab-ci.yml/不发生任何情况,gitlab,gitlab-ci,Gitlab,Gitlab Ci,我有一个gitlab.ci.yml来检查json文件: test: stage: test image: darrylb/jsonlint script: - for jsonfile in json/*.json; do jsonlint "$jsonfile"; done; only: changes: - json/* only: - merge_requests 我想在我的主分支

我有一个gitlab.ci.yml来检查json文件:

test:
    stage: test
    image: darrylb/jsonlint
    script:
      - for jsonfile in json/*.json; do jsonlint "$jsonfile"; done;
    only:
        changes:
            - json/*
    only:
        - merge_requests
我想在我的主分支的每个合并请求中自动运行它。 但当我创建合并请求时,没有发生任何事情,也没有启动管道。
我错过了什么?

将你的两个
关键字放在一起,如下所示:

test:
    stage: test
    image: darrylb/jsonlint
    script:
      - for jsonfile in json/*.json; do jsonlint "$jsonfile"; done;
    only:
      refs:
        - merge_requests
      changes:
        - json/*
以下是描述如何编写的dock:

如果您希望在所有子文件夹中的所有更改上触发它,而不仅仅是直接在文件夹中的文件上触发它,那么您可能必须将
json/*
更改为
json/*
,您检查了吗?您有“only:changes:-json/*”,MR是否包括对
json
文件夹中文件的更改?只需注意:-合并请求将在所有MRs上执行,而不仅仅是在master上。我建议复习。