Can't get labels-action to work with merge requests
Hi, I can't get the labels action to work with merge requests. Is it possible, that there is a bug with it? This is my log:
-----------------------------------
Processing rules for merge_requests
-----------------------------------
-----------------------------------
Processing rule: **Post Diff Link**
-----------------------------------
.[DEBUG] query_api: https://gitlab.com/api/v4/projects/dodod%2Fkarteikarten/merge_requests?per_page=100&state=opened
[DEBUG] rate_limit_infos: Rate limit remaining: 599 (reset at 2020-01-16 10:44:30 +0100)
* Found 3 resources...
* Filtering resources...
* Total after filtering: 2 resources
* Limiting resources...
* Total after limiting: 2 resources
[DEBUG] post_url: https://gitlab.com/api/v4/projects/15154122/merge_requests/6/notes?
[DEBUG] post_api: https://gitlab.com/api/v4/projects/15154122/merge_requests/6/notes?
[DEBUG] rate_limit_infos: Rate limit remaining: 598 (reset at 2020-01-16 10:44:30 +0100)
[DEBUG] post_url: https://gitlab.com/api/v4/projects/15154122/merge_requests/5/notes?
[DEBUG] post_api: https://gitlab.com/api/v4/projects/15154122/merge_requests/5/notes?
[DEBUG] rate_limit_infos: Rate limit remaining: 597 (reset at 2020-01-16 10:44:31 +0100)
This is my .triage-policies.yml
:
resource_rules:
merge_requests:
rules:
- name: Post Diff Link
conditions:
state: opened
ruby: attachedLabels.length() == 0
limits:
most_recent: 3
actions:
labels:
- "NeedsAttention"
This is my .gitlab-ci.yml
:
image: "ruby:2.5"
stages:
- triage
triage:
stage: triage
script:
- gem install gitlab-triage
- gitlab-triage --token $API_TOKEN --source projects --source-id $CI_PROJECT_PATH -r ./triage_plugin.rb --debug
And this is the code of the plugin I added:
module TriagePlugin
def mr_id
url.match(/(?<=merge_requests\/)[0-9]*/)
end
def url
resource[:web_url]
end
def attachedLabels
resource[:labels]
end
end
Gitlab::Triage::Resource::Context.include TriagePlugin
The label NeedsAttention exists, I used copy & paste to make sure I don't do any typos.
What am I doing wrong? Is it not yet possible to add labels to merge requests/is this buggy?