gitlab-triage 1.6.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 403aa273677c675e590d5c2a46c0feb1d5087e1369532cb7c3b063e79191bc8c
4
- data.tar.gz: 2f25cbdcad4c7b8ddd861d026711e396d8c1f9cc01f489a65166954694bc344c
3
+ metadata.gz: 115d63f58149d8ed49f22fcafc929b06ebcf7ba180cb1047121f61a7c67d890b
4
+ data.tar.gz: 13f5bfcfd2bcb8325a40566fe86e30e13f03eb2aa0e3935c0f91c53446867ae2
5
5
  SHA512:
6
- metadata.gz: 27804c7a88c2079a8559593381e4aa6a0a94bbc6b0d5f23e4624227953fb75b57d177f79b86dbb09ee0836c2be0f9637ac7f762da80f955ae88294943cd1d6fa
7
- data.tar.gz: 5ba384a4eb246540da8d23250240af00f4bdc30aa16e1dc17a1fbd4c294f3463e0a9cfefdce653d942ae738c7abc90ad55c28aff95f4c820247d027a18f2459b
6
+ metadata.gz: ac6caff9332e7cc266ea22abb7beed863c577e4d4d4a2fb4c63171cf1834b14b1d4f0abaf616408d7a3ae9261a1668ce5e54ff6de971e14fd5136f584d7e7cd3
7
+ data.tar.gz: 24e71190417f5e36deca4d1b6b1ee1991eecdf7930b5af852c7b861b75dd8e50071e7c0c051c04a84f9247a9a89e4887ec016f7896823b333c5350cc1643b7ba
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # GitLab Triage Project
4
4
 
5
- This project contains the library and pipeline definition to enable automated triaging of issues in the [GitLab Project](https://gitlab.com/gitlab-org/gitlab).
5
+ This project allows to automate triaging of issues and merge requests for GitLab projects or groups.
6
6
 
7
7
  ## gitlab-triage gem
8
8
 
@@ -851,6 +851,8 @@ Here's a list of currently available Ruby expression API:
851
851
  | labels_chronologically | [Label] | Same as `labels_with_details` but sorted chronologically |
852
852
  | label_events | [LabelEvent] | A list of label events on the resource |
853
853
  | instance_version | InstanceVersion | The version for the GitLab instance we're triaging with |
854
+ | project_path | String | The path with namespace to the issues or merge requests project |
855
+ | full_resource_reference | String | A full reference incuding project path to the issue or merge request |
854
856
 
855
857
  ##### Methods for `Milestone`
856
858
 
@@ -8,6 +8,10 @@ module Gitlab
8
8
  module Resource
9
9
  class Issue < Base
10
10
  include Shared::Issuable
11
+
12
+ def reference
13
+ '#'
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -8,6 +8,10 @@ module Gitlab
8
8
  module Resource
9
9
  class MergeRequest < Base
10
10
  include Shared::Issuable
11
+
12
+ def reference
13
+ '!'
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -49,6 +49,20 @@ module Gitlab
49
49
  @author ||= resource.dig(:author, :username)
50
50
  end
51
51
 
52
+ def project_path
53
+ @project_path ||=
54
+ request_project(resource[:project_id])[:path_with_namespace]
55
+ end
56
+
57
+ def full_resource_reference
58
+ @full_resource_reference ||=
59
+ "#{project_path}#{reference}#{resource[:iid]}"
60
+ end
61
+
62
+ def reference
63
+ raise NotImplementedError
64
+ end
65
+
52
66
  def root_id(
53
67
  resource: source_resource,
54
68
  max_levels: MAX_PARENT_LOOKUP)
@@ -72,6 +86,10 @@ module Gitlab
72
86
  resource_url(sub_resource_type: 'resource_label_events'))
73
87
  end
74
88
 
89
+ def request_project(project_id)
90
+ network.query_api_cached(project_url(project_id)).first
91
+ end
92
+
75
93
  def request_group(group_id)
76
94
  network.query_api_cached(group_url(group_id)).first
77
95
  end
@@ -83,6 +101,14 @@ module Gitlab
83
101
  source_id: group_id
84
102
  ).build
85
103
  end
104
+
105
+ def project_url(project_id)
106
+ Gitlab::Triage::UrlBuilders::UrlBuilder.new(
107
+ network_options: network.options,
108
+ source: 'projects',
109
+ source_id: project_id
110
+ ).build
111
+ end
86
112
  end
87
113
  end
88
114
  end
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Triage
3
- VERSION = '1.6.1'.freeze
3
+ VERSION = '1.7.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-triage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-13 00:00:00.000000000 Z
11
+ date: 2020-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport