issuer 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +150 -53
- data/examples/basic-example.yml +3 -0
- data/examples/new-project-issues.yml +3 -0
- data/examples/tag-removal-example.yml +41 -0
- data/examples/validation-test.yml +2 -0
- data/issuer.gemspec +1 -0
- data/lib/issuer/apis/github/client.rb +183 -3
- data/lib/issuer/cache.rb +13 -13
- data/lib/issuer/cli.rb +3 -5
- data/lib/issuer/issue.rb +95 -23
- data/lib/issuer/sites/github.rb +27 -11
- data/lib/issuer.rb +6 -6
- metadata +4 -2
data/lib/issuer/sites/github.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'octokit'
|
4
4
|
require_relative 'base'
|
5
|
+
require_relative '../apis/github/client'
|
5
6
|
|
6
7
|
module Issuer
|
7
8
|
module Sites
|
@@ -14,6 +15,7 @@ module Issuer
|
|
14
15
|
# Skip authentication validation for dry-run mode
|
15
16
|
if @token == 'dry-run-token'
|
16
17
|
@client = nil
|
18
|
+
@octokit_client = nil
|
17
19
|
return
|
18
20
|
end
|
19
21
|
|
@@ -22,8 +24,11 @@ module Issuer
|
|
22
24
|
raise Issuer::Error, "GitHub token not found. Set #{env_vars.join(', ')} environment variable."
|
23
25
|
end
|
24
26
|
|
25
|
-
|
26
|
-
@client
|
27
|
+
# Create our enhanced API client that supports GraphQL
|
28
|
+
@client = Issuer::APIs::GitHub::Client.new(token: @token)
|
29
|
+
# Keep the Octokit client for non-issue operations
|
30
|
+
@octokit_client = Octokit::Client.new(access_token: @token)
|
31
|
+
@octokit_client.auto_paginate = true
|
27
32
|
end
|
28
33
|
|
29
34
|
def site_name
|
@@ -41,6 +46,7 @@ module Issuer
|
|
41
46
|
milestone: 'milestone', # site_params[:milestone] displays as "milestone:"
|
42
47
|
labels: 'labels', # site_params[:labels] displays as "labels:"
|
43
48
|
assignee: 'assignee', # site_params[:assignee] displays as "assignee:"
|
49
|
+
type: 'type', # site_params[:type] displays as "type:"
|
44
50
|
project_name: 'repo' # For summary messages: "repo: owner/name"
|
45
51
|
}
|
46
52
|
end
|
@@ -83,7 +89,12 @@ module Issuer
|
|
83
89
|
end
|
84
90
|
end
|
85
91
|
|
86
|
-
|
92
|
+
# Handle type
|
93
|
+
if issue_params[:type]
|
94
|
+
params[:type] = issue_params[:type]
|
95
|
+
end
|
96
|
+
|
97
|
+
created_issue = @client.create_issue(proj, params)
|
87
98
|
|
88
99
|
# Extract relevant data for potential cleanup tracking
|
89
100
|
issue_data = {
|
@@ -101,13 +112,13 @@ module Issuer
|
|
101
112
|
end
|
102
113
|
|
103
114
|
def get_versions proj
|
104
|
-
@
|
115
|
+
@octokit_client.milestones(proj, state: 'all')
|
105
116
|
rescue Octokit::Error => e
|
106
117
|
raise Issuer::Error, "Failed to fetch milestones: #{e.message}"
|
107
118
|
end
|
108
119
|
|
109
120
|
def get_tags proj
|
110
|
-
@
|
121
|
+
@octokit_client.labels(proj)
|
111
122
|
rescue Octokit::Error => e
|
112
123
|
raise Issuer::Error, "Failed to fetch labels: #{e.message}"
|
113
124
|
end
|
@@ -116,7 +127,7 @@ module Issuer
|
|
116
127
|
description = options[:description] || "Created by issuer CLI"
|
117
128
|
|
118
129
|
# Call create_milestone with proper parameters
|
119
|
-
created_milestone = @
|
130
|
+
created_milestone = @octokit_client.create_milestone(proj, version_name, description: description)
|
120
131
|
|
121
132
|
# Add the newly created milestone to our cache for immediate availability
|
122
133
|
@milestone_cache[proj] ||= []
|
@@ -142,7 +153,7 @@ module Issuer
|
|
142
153
|
description = options[:description]
|
143
154
|
|
144
155
|
# Call add_label with proper parameters
|
145
|
-
created_label = @
|
156
|
+
created_label = @octokit_client.add_label(proj, tag_name, color, description: description)
|
146
157
|
|
147
158
|
# Return tracking data
|
148
159
|
{
|
@@ -161,26 +172,26 @@ module Issuer
|
|
161
172
|
|
162
173
|
# Cleanup methods
|
163
174
|
def close_issue proj, issue_number
|
164
|
-
@
|
175
|
+
@octokit_client.close_issue(proj, issue_number)
|
165
176
|
rescue Octokit::Error => e
|
166
177
|
raise Issuer::Error, "Failed to close issue ##{issue_number}: #{e.message}"
|
167
178
|
end
|
168
179
|
|
169
180
|
def delete_milestone proj, milestone_number
|
170
|
-
@
|
181
|
+
@octokit_client.delete_milestone(proj, milestone_number)
|
171
182
|
rescue Octokit::Error => e
|
172
183
|
raise Issuer::Error, "Failed to delete milestone ##{milestone_number}: #{e.message}"
|
173
184
|
end
|
174
185
|
|
175
186
|
def delete_label proj, label_name
|
176
|
-
@
|
187
|
+
@octokit_client.delete_label!(proj, label_name)
|
177
188
|
rescue Octokit::Error => e
|
178
189
|
raise Issuer::Error, "Failed to delete label '#{label_name}': #{e.message}"
|
179
190
|
end
|
180
191
|
|
181
192
|
def validate_configuration
|
182
193
|
# Test API access
|
183
|
-
@
|
194
|
+
@octokit_client.user
|
184
195
|
true
|
185
196
|
rescue Octokit::Error => e
|
186
197
|
raise Issuer::Error, "GitHub authentication failed: #{e.message}"
|
@@ -225,6 +236,11 @@ module Issuer
|
|
225
236
|
end
|
226
237
|
end
|
227
238
|
|
239
|
+
# Handle type
|
240
|
+
if issue.type && !issue.type.strip.empty?
|
241
|
+
params[:type] = issue.type.strip
|
242
|
+
end
|
243
|
+
|
228
244
|
params
|
229
245
|
end
|
230
246
|
|
data/lib/issuer.rb
CHANGED
@@ -25,7 +25,7 @@ require_relative "issuer/cli"
|
|
25
25
|
# * Configurable defaults and label application logic
|
26
26
|
# * Environment variable support for authentication
|
27
27
|
# * Issue validation with helpful error messages
|
28
|
-
# * Extensible architecture for multiple platforms (GitHub,
|
28
|
+
# * Extensible architecture for multiple platforms (GitHub, Jira, GitLab, etc.)
|
29
29
|
# * Run logging and artifact tracking for cleanup operations
|
30
30
|
#
|
31
31
|
# == Quick Start
|
@@ -81,7 +81,7 @@ module Issuer
|
|
81
81
|
# @param site [Issuer::Sites::Base, nil] Custom site adapter. If nil, will auto-detect.
|
82
82
|
# @param cache [Boolean] Whether to enable run tracking and caching (default: true)
|
83
83
|
#
|
84
|
-
def initialize
|
84
|
+
def initialize site: nil, cache: true
|
85
85
|
@site = site
|
86
86
|
@cache_enabled = cache
|
87
87
|
end
|
@@ -107,7 +107,7 @@ module Issuer
|
|
107
107
|
# automation_options: { auto_metadata: true })
|
108
108
|
# puts "Created #{results[:issues_created]} issues"
|
109
109
|
#
|
110
|
-
def process_file
|
110
|
+
def process_file file_path, proj: nil, dry_run: false, automation_options: {}
|
111
111
|
require 'yaml'
|
112
112
|
|
113
113
|
unless File.exist?(file_path)
|
@@ -134,7 +134,7 @@ module Issuer
|
|
134
134
|
# @return [Hash] Results including created issues, milestones, labels, and run metadata
|
135
135
|
# @raise [Issuer::Error] If data is invalid or processing fails
|
136
136
|
#
|
137
|
-
def process_data
|
137
|
+
def process_data data, proj: nil, dry_run: false, automation_options: {}
|
138
138
|
# Extract metadata and issues
|
139
139
|
meta = data['$meta'] || {}
|
140
140
|
issues_data = data['issues'] || data
|
@@ -176,7 +176,7 @@ module Issuer
|
|
176
176
|
@site ||= Sites::Factory.create(Sites::Factory.default_site)
|
177
177
|
end
|
178
178
|
|
179
|
-
def perform_dry_run
|
179
|
+
def perform_dry_run issues, repo
|
180
180
|
site = Sites::Factory.create('github', token: 'dry-run-token')
|
181
181
|
|
182
182
|
puts "🧪 DRY RUN - No issues will be created"
|
@@ -201,7 +201,7 @@ module Issuer
|
|
201
201
|
}
|
202
202
|
end
|
203
203
|
|
204
|
-
def perform_live_run
|
204
|
+
def perform_live_run issues, repo, automation_options
|
205
205
|
site = get_site
|
206
206
|
|
207
207
|
# Start run tracking if caching enabled
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: issuer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DocOps Lab
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- examples/basic-example.yml
|
125
125
|
- examples/minimal-example.yml
|
126
126
|
- examples/new-project-issues.yml
|
127
|
+
- examples/tag-removal-example.yml
|
127
128
|
- examples/validation-test.yml
|
128
129
|
- exe/issuer
|
129
130
|
- issuer.gemspec
|
@@ -144,6 +145,7 @@ metadata:
|
|
144
145
|
homepage_uri: https://github.com/DocOps/issuer
|
145
146
|
source_code_uri: https://github.com/DocOps/issuer
|
146
147
|
changelog_uri: https://github.com/DocOps/issuer/blob/main/CHANGELOG.md
|
148
|
+
documentation_uri: https://gemdocs.org/gems/issuer/0.2.1
|
147
149
|
post_install_message:
|
148
150
|
rdoc_options: []
|
149
151
|
require_paths:
|