issuer 0.1.0
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 +7 -0
- data/.rspec +3 -0
- data/.vale/config/vocabularies/issuer/accept.txt +63 -0
- data/.vale/config/vocabularies/issuer/reject.txt +21 -0
- data/.vale.ini +42 -0
- data/Dockerfile +43 -0
- data/LICENSE +21 -0
- data/README.adoc +539 -0
- data/Rakefile +70 -0
- data/bin/console +0 -0
- data/bin/issuer +13 -0
- data/bin/setup +0 -0
- data/examples/README.adoc +56 -0
- data/examples/advanced-stub-example.yml +50 -0
- data/examples/basic-example.yml +33 -0
- data/examples/minimal-example.yml +9 -0
- data/examples/new-project-issues.yml +162 -0
- data/examples/validation-test.yml +8 -0
- data/exe/issuer +5 -0
- data/issuer.gemspec +43 -0
- data/lib/issuer/apis/github/client.rb +124 -0
- data/lib/issuer/cache.rb +197 -0
- data/lib/issuer/cli.rb +241 -0
- data/lib/issuer/issue.rb +393 -0
- data/lib/issuer/ops.rb +281 -0
- data/lib/issuer/sites/base.rb +109 -0
- data/lib/issuer/sites/factory.rb +31 -0
- data/lib/issuer/sites/github.rb +248 -0
- data/lib/issuer/version.rb +21 -0
- data/lib/issuer.rb +238 -0
- data/scripts/build.sh +40 -0
- data/scripts/lint-docs.sh +64 -0
- data/scripts/manage-runs.rb +175 -0
- data/scripts/pre-commit-template.sh +54 -0
- data/scripts/publish.sh +92 -0
- data/scripts/setup-vale.sh +59 -0
- data/specs/tests/README.adoc +451 -0
- data/specs/tests/check-github-connectivity.sh +130 -0
- data/specs/tests/cleanup-github-tests.sh +374 -0
- data/specs/tests/github-api/01-auth-connection.yml +21 -0
- data/specs/tests/github-api/02-basic-issues.yml +90 -0
- data/specs/tests/github-api/03-milestone-tests.yml +58 -0
- data/specs/tests/github-api/04-label-tests.yml +98 -0
- data/specs/tests/github-api/05-assignment-tests.yml +55 -0
- data/specs/tests/github-api/06-automation-tests.yml +102 -0
- data/specs/tests/github-api/07-error-tests.yml +29 -0
- data/specs/tests/github-api/08-complex-tests.yml +197 -0
- data/specs/tests/github-api/config.yml.example +17 -0
- data/specs/tests/rspec/cli_spec.rb +127 -0
- data/specs/tests/rspec/issue_spec.rb +184 -0
- data/specs/tests/rspec/issuer_spec.rb +5 -0
- data/specs/tests/rspec/ops_spec.rb +124 -0
- data/specs/tests/rspec/spec_helper.rb +54 -0
- data/specs/tests/run-github-api-tests.sh +424 -0
- metadata +200 -0
data/README.adoc
ADDED
@@ -0,0 +1,539 @@
|
|
1
|
+
= Issuer: Bulk GitHub Issue Creator
|
2
|
+
:toc: macro
|
3
|
+
:toclevels: 3
|
4
|
+
:this_prod_vrsn: 0.1.0
|
5
|
+
:next_prod_vrsn: 0.2.0
|
6
|
+
:docker_base_command: docker run -it --rm -v $(pwd):/workdir -e GITHUB_TOKEN=$ISSUER_API_TOKEN docopslab/issuer
|
7
|
+
:append_or_impose: Prepend items with `+` to indicate they should be appended to existing labels. Items without `+` will only be used for issues with no `tags` designated.
|
8
|
+
ifdef::env-github[]
|
9
|
+
:icons: font
|
10
|
+
endif::[]
|
11
|
+
|
12
|
+
|
13
|
+
== Overview
|
14
|
+
|
15
|
+
_Issuer_ lets you define all your work tickets in one place as YAML, apply defaults, and post them to GitHub Issues in bulk.
|
16
|
+
|
17
|
+
=== Features
|
18
|
+
|
19
|
+
* *Bulk issue creation* from a single YAML file
|
20
|
+
* *Dry-run mode* for testing without creating issues
|
21
|
+
* *Automatic milestone creation* if milestones don't exist
|
22
|
+
* *Configurable defaults* and label application
|
23
|
+
* *Environment variable support* for authentication
|
24
|
+
* *Issue validation* with helpful error messages
|
25
|
+
* *GitHub API integration* via Octokit
|
26
|
+
|
27
|
+
Future plans include extending this capability to *JIRA*, *GitLab* Issues, GitHub *Projects*, and other services.
|
28
|
+
|
29
|
+
toc::[]
|
30
|
+
|
31
|
+
|
32
|
+
== Installation
|
33
|
+
|
34
|
+
For end users, there are two ways to execute `issuer`.
|
35
|
+
If you do not already operate in a Ruby environment, the Docker approach is recommended.
|
36
|
+
|
37
|
+
=== For Non-Ruby Users
|
38
|
+
|
39
|
+
If you are not already a Ruby user, the `issuer` utility may be best used from our Docker image.
|
40
|
+
|
41
|
+
[NOTE]
|
42
|
+
You will need *Docker Desktop* installed https://docs.docker.com/desktop/setup/install/mac-install/[directly on MacOS] or https://docs.docker.com/desktop/features/wsl/[with WSL2 backend on Windows], but all instructions here work in the _terminal_.
|
43
|
+
For Linux, use the https://docs.docker.com/engine/install/[Docker Engine install docs] if you're not already using Docker.
|
44
|
+
|
45
|
+
With Docker installed and running...
|
46
|
+
|
47
|
+
. Download the Docker image.
|
48
|
+
+
|
49
|
+
[.prompt]
|
50
|
+
docker pull docopslab/issuer
|
51
|
+
|
52
|
+
. Run the `issuer` command via a container based on the Docker image.
|
53
|
+
+
|
54
|
+
[.prompt,subs=+attributes]
|
55
|
+
{docker_base_command} --version
|
56
|
+
|
57
|
+
For actual issue creation, use something like:
|
58
|
+
|
59
|
+
[.prompt,subs=+attributes]
|
60
|
+
{docker_base_command} your-issues.yml --dry
|
61
|
+
|
62
|
+
The above command:
|
63
|
+
|
64
|
+
* mounts your local directory to be readable by the Docker container
|
65
|
+
* passes your GitHub access token environment variable into the container (`$ISSUER_API_TOKEN` could be `$ISSER_GITHUB_TOKEN`, `$GITHUB_ACCESS_TOKEN`, or `$GITHUB_TOKEN`).
|
66
|
+
|
67
|
+
Everything after `docopslab/issuer` accepts the standard arguments and options of the issuer CLI.
|
68
|
+
|
69
|
+
[[docker-alias]]
|
70
|
+
==== Alias the Docker Command
|
71
|
+
|
72
|
+
Optionally alias the base Docker command.
|
73
|
+
In your shell configuration (usually `~/.bashrc` or `~/.zshrc), add the following:
|
74
|
+
|
75
|
+
[.prompt,subs=+attributes]
|
76
|
+
alias issuer='{docker_base_command}'
|
77
|
+
|
78
|
+
Reload your shell configuration for the alias to take effect:
|
79
|
+
|
80
|
+
[.prompt]
|
81
|
+
source ~/.bashrc
|
82
|
+
|
83
|
+
=== For Ruby Users
|
84
|
+
|
85
|
+
If you have Ruby on your workstation, there are two common ways to install thi gem.
|
86
|
+
|
87
|
+
==== Global Installation
|
88
|
+
|
89
|
+
[.prompt]
|
90
|
+
gem install issuer
|
91
|
+
|
92
|
+
Then you can use the `issuer` command from anywhere in your system.
|
93
|
+
|
94
|
+
==== Local/Applicaition Installation
|
95
|
+
|
96
|
+
Add this line to your Gemfile:
|
97
|
+
|
98
|
+
[source,ruby]
|
99
|
+
----
|
100
|
+
gem 'issuer'
|
101
|
+
----
|
102
|
+
|
103
|
+
And then execute:
|
104
|
+
|
105
|
+
bundle install
|
106
|
+
|
107
|
+
Now you can use `bundle exec issuer` to perform operations inside the project directory.
|
108
|
+
|
109
|
+
|
110
|
+
== Usage
|
111
|
+
|
112
|
+
Once installed, you can start using `issuer` to create issues in GitHub.
|
113
|
+
|
114
|
+
=== Quickstart Overview
|
115
|
+
|
116
|
+
The following steps assume the gem is either installed globally or `issuer` is <<docker-alias,established as an alias>>.
|
117
|
+
For Ruby Bundler usage, prepend `bundle exec ` and for un-aliased Docker usage, prepend `{docker_base_command}`.
|
118
|
+
|
119
|
+
. Prepare your issue definitions in an IMYML file (see <<imyml-format,examples and docs>> below).
|
120
|
+
|
121
|
+
. Perform a "`dry run`" to validate your file and check what would be posted (no GitHub API calls made):
|
122
|
+
+
|
123
|
+
issuer example.yml --dry
|
124
|
+
|
125
|
+
. Establish a Personal Access Token for GitHub (see <<authentication,Authentication>> below).
|
126
|
+
|
127
|
+
. Post issues to GitHub:
|
128
|
+
+
|
129
|
+
[.prompt]
|
130
|
+
issuer example.yml
|
131
|
+
|
132
|
+
[[imyml-format]]
|
133
|
+
=== IMYML File Format
|
134
|
+
|
135
|
+
The specially formatted configuration files are structured as _IMYML_, for Issue Management YAML-based Modeling Format.
|
136
|
+
|
137
|
+
The YAML file must have the following structure:
|
138
|
+
|
139
|
+
[source,yaml]
|
140
|
+
----
|
141
|
+
$meta: # optional block for establishing general modes/settings
|
142
|
+
proj: org/repo
|
143
|
+
defaults: # value to infer when given property missing
|
144
|
+
vrsn: 0.1.0 # milestone/version
|
145
|
+
user: alice # assigned user
|
146
|
+
tags: [needs_labels,+posted_by_issuer] # labels
|
147
|
+
stub: true # whether to auto-insert stub texts
|
148
|
+
head: | # header stub text to prepend when indicated
|
149
|
+
Below the next line is the body...
|
150
|
+
---
|
151
|
+
tail: | # footer stub text to append when indicated
|
152
|
+
---
|
153
|
+
This issue was automatically generated by issuer.
|
154
|
+
body: | # body text to impose when no body provided
|
155
|
+
This is the default text that will appear if an issue record is a _stub_ and no `body` field is designated.
|
156
|
+
issues: # block for listing issues to post to cloud
|
157
|
+
- summ: Issue title # title/summary field
|
158
|
+
body: | # description/body field
|
159
|
+
Markdown-formatted description.
|
160
|
+
tags: [label1, 'component:api'] # labels to create/assign
|
161
|
+
user: someusername # assigned username
|
162
|
+
stub: false
|
163
|
+
- summ: Another issue
|
164
|
+
vrsn: 0.2.0 # milestone
|
165
|
+
# this issue record's body will be:
|
166
|
+
# Below the next line is the body...
|
167
|
+
# ---
|
168
|
+
# This is the default text that will appear if an issue record is a _stub_ and no `body` field is designated.
|
169
|
+
# ---
|
170
|
+
# This issue was automatically generated by issuer.
|
171
|
+
----
|
172
|
+
|
173
|
+
The `$meta` block is entirely optional, but if it is absent, your `issuer` command will need a `--proj` flag to designate the GitHub repo to which your issues should post.
|
174
|
+
|
175
|
+
Only the `summ` property is required for each issue record, and issue records (Array items) that are simple strings that will be treated as summary-only.
|
176
|
+
Therefore, the following example would yield 3 tickets with unique summaries and the same body, based on `$meta.defaults.body`.
|
177
|
+
|
178
|
+
[source,yaml]
|
179
|
+
----
|
180
|
+
$meta:
|
181
|
+
defaults:
|
182
|
+
body: |
|
183
|
+
This is a placeholder text until someone is assigned this ticket.
|
184
|
+
stub: true
|
185
|
+
issues:
|
186
|
+
- summ: Fill out issue bodies and add labels/milestones
|
187
|
+
body: |
|
188
|
+
The rest of the tickets in this project are not filled out.
|
189
|
+
tags: ['priority:high']
|
190
|
+
- Make a README.adoc file
|
191
|
+
- Add a license to the repo
|
192
|
+
----
|
193
|
+
|
194
|
+
[TIP]
|
195
|
+
This repository contains numerous link:lib/examples/README.adoc[example files] to use for inspiration.
|
196
|
+
|
197
|
+
The IMYML format will be standardized and formally specified in a future release of _issuer_, but it will remain an _open standard_ adoptable by anyone who wants to exploit or extend it.
|
198
|
+
|
199
|
+
[[imyml-ref]]
|
200
|
+
==== IMYML Properties Reference
|
201
|
+
|
202
|
+
`$meta`::
|
203
|
+
Optional block for establishing operation-wide modes and settings.
|
204
|
+
|
205
|
+
`$meta.proj`:::
|
206
|
+
(String)
|
207
|
+
Designates the target project/repository.
|
208
|
+
|
209
|
+
`$meta.defaults`:::
|
210
|
+
Designates the default values to use for any issue record that does not specify a value for a given property.
|
211
|
+
|
212
|
+
`$meta.defaults.vrsn`::::
|
213
|
+
(String)
|
214
|
+
Sets default version or milestone for all issues.
|
215
|
+
|
216
|
+
`$meta.defaults.user`::::
|
217
|
+
(String)
|
218
|
+
Sets default assignee (GitHub username).
|
219
|
+
|
220
|
+
`$meta.defaults.tags`::::
|
221
|
+
(Array):
|
222
|
+
Labels to append to issues (comma-separated).
|
223
|
+
{append_or_impose}
|
224
|
+
|
225
|
+
`$meta.defaults.stub`::::
|
226
|
+
(Boolean)
|
227
|
+
Establishes the state whether to insert stub texts (`body` / `head` / `tail`).
|
228
|
+
|
229
|
+
`$meta.defaults.body`::::
|
230
|
+
(String)
|
231
|
+
Sets default body text to apply to all issues when no `body` property is specified in the issue record.
|
232
|
+
|
233
|
+
`$meta.defaults.head`::::
|
234
|
+
(String)
|
235
|
+
Sets default text to insert before the body of all issues for which `stub`.
|
236
|
+
|
237
|
+
`$meta.defaults.tail`::::
|
238
|
+
(String)
|
239
|
+
Sets default text to insert after the body of all issues for which `stub`.
|
240
|
+
|
241
|
+
`issues`::
|
242
|
+
(Array) Tabular listing of issue records as Array itmes.
|
243
|
+
If an item is Scalar (not a Map with named keys), the value must be a String and it will be treated as the `summ` (summary/title) property.
|
244
|
+
+
|
245
|
+
Otherwise, any `issues` Array items must be Map-formatted "`dictionaries`" with the following properties:
|
246
|
+
|
247
|
+
`summ`:::
|
248
|
+
(String, *required*)
|
249
|
+
A one-line title or summary of the issue.
|
250
|
+
|
251
|
+
`body`:::
|
252
|
+
(String)
|
253
|
+
The main body or description text for the issue.
|
254
|
+
Defaults to `$meta.defaults.body` if `stub == true` for the record, in which case, upon submission, will also incorporate any values for `$meta.defaults.head` and `$meta.defaults.tail`.
|
255
|
+
|
256
|
+
`vrsn`:::
|
257
|
+
(String)
|
258
|
+
The milestone associated with the issue.
|
259
|
+
+
|
260
|
+
Defaults to `$meta.defaults.vrsn` or else `null`.
|
261
|
+
|
262
|
+
`tags`:::
|
263
|
+
(Array of Strings)
|
264
|
+
A listing of specific labels to assign to the issue.
|
265
|
+
|
266
|
+
`user`:::
|
267
|
+
(String)
|
268
|
+
The system username of the person or bot to which the ticket is assigned.
|
269
|
+
|
270
|
+
`stub [true+++*+++|false]`:::
|
271
|
+
(Boolean)
|
272
|
+
Whether to treat the issue as a stub entry, meaning prepend any `$meta.defaults.head` text or append any `$meta.defaults.tail` text, and in case the ticket has no `body` property, insert the text of `$meta.defaults.body`.
|
273
|
+
|
274
|
+
[[cli-usage]]
|
275
|
+
=== CLI Usage
|
276
|
+
|
277
|
+
issuer [IMYML_FILE] [options]
|
278
|
+
|
279
|
+
==== IMYML File Path Argument
|
280
|
+
|
281
|
+
A source IMYML file is required and can be specified in two ways:
|
282
|
+
|
283
|
+
* *Positional argument* (most common): Place the file path immediately after `issuer`
|
284
|
+
* *Named option*: Use the `--file` option flag to specify the file path
|
285
|
+
|
286
|
+
Examples:
|
287
|
+
|
288
|
+
....
|
289
|
+
issuer my-issues.yml --proj acmeco/widget1 --dry
|
290
|
+
issuer --proj acmeco/widget1 --file my-issues.yml --dry
|
291
|
+
....
|
292
|
+
|
293
|
+
==== File and Meta Override Options
|
294
|
+
|
295
|
+
These options specify the source file and override any corresponding `$meta.defaults` properties.
|
296
|
+
|
297
|
+
--file _IMYML_FILE_::
|
298
|
+
IMYML file path (alternative to positional argument).
|
299
|
+
|
300
|
+
--proj _ORG/REPO_::
|
301
|
+
The target project (org/repo or user/repo format for GitHub).
|
302
|
+
|
303
|
+
--vrsn _VERSION_::
|
304
|
+
Argues default milestone for all issues.
|
305
|
+
|
306
|
+
--user _USERNAME_::
|
307
|
+
Argues default assignee (GitHub username).
|
308
|
+
|
309
|
+
--tags _TAG_[,_TAG_]::
|
310
|
+
Argues labels to impose or add issues (comma-separated).
|
311
|
+
{append_or_impose}
|
312
|
+
|
313
|
+
--stub [_true_+++*+++|_false_]::
|
314
|
+
Whether to treat all issues as stubs, meaning prepend any `$meta.defaults.head` text or append any `$meta.defaults.tail` text, and in case the ticket has no `body` property, insert the text of `$meta.defaults.body`.
|
315
|
+
|
316
|
+
==== Mode Options
|
317
|
+
|
318
|
+
--dry::
|
319
|
+
Dry-run: print actions but do not post to GitHub.
|
320
|
+
|
321
|
+
--auto-versions, --auto-milestones::
|
322
|
+
Automatically create missing milestones/versions without prompting for confirmation.
|
323
|
+
|
324
|
+
--auto-tags, --auto-labels::
|
325
|
+
Automatically create missing labels/tags without prompting for confirmation.
|
326
|
+
|
327
|
+
--auto-metadata::
|
328
|
+
Automatically create all missing metadata (milestones and labels) without prompting for confirmation. Equivalent to using both `--auto-versions` and `--auto-tags`.
|
329
|
+
|
330
|
+
--help::
|
331
|
+
Prints the usage screen.
|
332
|
+
|
333
|
+
--version::
|
334
|
+
Prints the version of `issuer`.
|
335
|
+
|
336
|
+
[[authentication]]
|
337
|
+
=== Authentication
|
338
|
+
|
339
|
+
GitHub authentication requires a valid personal access token.
|
340
|
+
|
341
|
+
The application will check for environment variables in the following order:
|
342
|
+
|
343
|
+
. `ISSUER_API_TOKEN`
|
344
|
+
. `ISSUER_GITHUB_TOKEN`
|
345
|
+
. `GITHUB_ACCESS_TOKEN`
|
346
|
+
. `GITHUB_TOKEN`
|
347
|
+
|
348
|
+
To *create and set a token*:
|
349
|
+
|
350
|
+
. In the GitHub Web interface, go to *Settings* (under your user icon) ā *Developer Settings* (bottom of left menu) ā *Personal Access Tokens* ā *Fine-grained tokens*.
|
351
|
+
. Generate a new token with access to *All repositoriess* or any *Select repositories* you wish to post to, and include read/write permissions GitHub Issues (under *Repository permissions*).
|
352
|
+
. Copy the token and set it as an environment variable.
|
353
|
+
+
|
354
|
+
.Example
|
355
|
+
export ISSUER_API_TOKEN=github_pat_xxxxxxxxxxxxxxxxxxxxxxxx
|
356
|
+
+
|
357
|
+
Where `github_pat_xxxxxxxxxxxxxxxxxxxxxxxx` is your actual token.
|
358
|
+
|
359
|
+
|
360
|
+
== Advanced Usage
|
361
|
+
|
362
|
+
=== Logging
|
363
|
+
|
364
|
+
Issuer automatically logs all API operations for tracking and potential cleanup.
|
365
|
+
|
366
|
+
==== Log Storage Location
|
367
|
+
|
368
|
+
By default, logs are stored in a user-wide directory:
|
369
|
+
|
370
|
+
* *Linux/macOS*: `~/.config/issuer/logs/`
|
371
|
+
* *With XDG Base Directory*: `$XDG_CONFIG_HOME/issuer/logs/`
|
372
|
+
* *Custom location*: Set `ISSUER_CONFIG_DIR` environment variable
|
373
|
+
|
374
|
+
Example:
|
375
|
+
[source,bash]
|
376
|
+
----
|
377
|
+
# Use custom config directory
|
378
|
+
export ISSUER_CONFIG_DIR="~/path/to/my/issuer/config"
|
379
|
+
issuer my-issues.yml
|
380
|
+
|
381
|
+
# Logs will be stored in: ~/path/to/my/issuer/config/logs/
|
382
|
+
----
|
383
|
+
|
384
|
+
==== Log Management
|
385
|
+
|
386
|
+
Use the management script to view and manage your run logs.
|
387
|
+
|
388
|
+
For now, you will need to *clone the DocOps/issuer repo* in order to work with the run-logs manager.
|
389
|
+
|
390
|
+
[source,bash]
|
391
|
+
----
|
392
|
+
# List all runs
|
393
|
+
ruby scripts/manage-runs.rb list
|
394
|
+
|
395
|
+
# Show details for a specific run
|
396
|
+
ruby scripts/manage-runs.rb show run_20250711_143022_abcd
|
397
|
+
|
398
|
+
# Clean up all logs (use with caution)
|
399
|
+
ruby scripts/manage-runs.rb clean-logs
|
400
|
+
----
|
401
|
+
|
402
|
+
Each run creates a detailed log with:
|
403
|
+
|
404
|
+
* All created issues, milestones, and labels
|
405
|
+
* URLs for easy access
|
406
|
+
* Run metadata and status
|
407
|
+
* Error information if the run failed
|
408
|
+
|
409
|
+
[NOTE]
|
410
|
+
It is typically safe to delete logs once you are satisfied with your posted issues.
|
411
|
+
Logs are simply kept for easy reversal of mis-postings.
|
412
|
+
|
413
|
+
|
414
|
+
== Development
|
415
|
+
|
416
|
+
I developed the 0.1.0 version of this application after trying to use GitHub Copilot to automatically bulk-create issue tickets, which it promises to be able to do but failed me pretty hard at it.
|
417
|
+
|
418
|
+
That facility seems like a perfectly inappropriate use of generative AI.
|
419
|
+
It accepted my plan request and pre-drafted ticket content, but then it wanted me to manually add labels and milestones to them, as well as manually click *create* on each one -- even though I had already taken the time to plan and instruct the milestones and labels and the contents were fullly prepared.
|
420
|
+
|
421
|
+
Additionally, I find myself using different issue-management systems (JIRA, GitLab Issues, etc), so I wanted a more platform-agnostic way to handle this problem.
|
422
|
+
With that in mind, I have left the Ruby API and the IMYML model fairly "`generic`" for extensibility.
|
423
|
+
I will probably adapt the API to other systems in future releases, and I welcome <<contributing,contributions>> to that effect.
|
424
|
+
|
425
|
+
=== Methodology Confession
|
426
|
+
|
427
|
+
I should note up front that this is the closest I have come to "`vibe coding`" anything bigger than a local script, let alone a shippable production code.
|
428
|
+
Nevertheless, I intervened to make substantial and specific changes at least 100 times, and I rearranged major aspects of the codebase.
|
429
|
+
|
430
|
+
I designed the IMYML format and the CLI up front, then I let Claud 4 (via GH Copilot) draft most of the code.
|
431
|
+
It committed lots of rookie mistakes during this process, and it even confessed to "`cargo-cult programming`" when I pointed out it was introduing some anti-patterns.
|
432
|
+
|
433
|
+
In the end, the only thing that is mainly untouched by me are the rspec tests, which I will more fully examine and approve before any 1.0 release, but for now they'll have to do.
|
434
|
+
|
435
|
+
This also explains why the terminal output contains emojis.
|
436
|
+
I will probably make those togglable or configurable in the future.
|
437
|
+
|
438
|
+
=== Tests
|
439
|
+
|
440
|
+
The `specs/` directory contains all specifications, requirements, and tests for the Issuer CLI tool.
|
441
|
+
|
442
|
+
==== Directory Structure
|
443
|
+
|
444
|
+
[source,tree]
|
445
|
+
----
|
446
|
+
specs/
|
447
|
+
āāā tests/
|
448
|
+
āāā rspec/
|
449
|
+
āāā spec_helper.rb
|
450
|
+
āāā cli_spec.rb
|
451
|
+
āāā issue_spec.rb
|
452
|
+
āāā ops_spec.rb
|
453
|
+
āāā issuer_spec.rb
|
454
|
+
----
|
455
|
+
|
456
|
+
==== Running Tests
|
457
|
+
|
458
|
+
From the project root:
|
459
|
+
|
460
|
+
[source,bash]
|
461
|
+
----
|
462
|
+
# Run all PR tests locally (same as GitHub Actions)
|
463
|
+
bundle exec rake pr_test
|
464
|
+
|
465
|
+
# Run all tests (recommended)
|
466
|
+
bundle exec rake spec
|
467
|
+
|
468
|
+
# Run all tests directly with RSpec
|
469
|
+
bundle exec rspec
|
470
|
+
|
471
|
+
# Run specific test file
|
472
|
+
bundle exec rspec specs/tests/rspec/cli_spec.rb
|
473
|
+
|
474
|
+
# Run tests matching a pattern
|
475
|
+
bundle exec rspec --pattern "*ops*"
|
476
|
+
----
|
477
|
+
|
478
|
+
===== PR Test Suite
|
479
|
+
|
480
|
+
The `pr_test` task runs the exact same tests that GitHub Actions runs for pull requests:
|
481
|
+
|
482
|
+
* **RSpec Tests**: All unit tests (`bundle exec rake spec`)
|
483
|
+
* **CLI Tests**: Command-line interface functionality tests
|
484
|
+
* **YAML Validation**: Validates all example YAML files
|
485
|
+
* **Documentation Quality**: Vale linting on all documentation files
|
486
|
+
|
487
|
+
This ensures you can validate your changes locally before pushing to GitHub.
|
488
|
+
|
489
|
+
==== Test Organization
|
490
|
+
|
491
|
+
RSpec Tests::
|
492
|
+
(`specs/tests/rspec/`): Executable tests that validate the gem functionality
|
493
|
+
|
494
|
+
GitHub API Integration Tests::
|
495
|
+
(`specs/tests/github-api/`): Comprehensive end-to-end tests for GitHub API integration
|
496
|
+
|
497
|
+
Test Data::
|
498
|
+
(`specs/tests/data/`): YAML files, fixtures, and other test assets
|
499
|
+
|
500
|
+
Future::
|
501
|
+
Natural language specifications, API schemas, requirement documents
|
502
|
+
|
503
|
+
==== GitHub API Integration Testing
|
504
|
+
|
505
|
+
For comprehensive GitHub API testing, see link:specs/tests/README.adoc[the GitHub API test suite documentation].
|
506
|
+
|
507
|
+
Quick start for API integration testing:
|
508
|
+
|
509
|
+
[source,bash]
|
510
|
+
----
|
511
|
+
# Check GitHub connectivity
|
512
|
+
./specs/tests/check-github-connectivity.sh
|
513
|
+
|
514
|
+
# Run full GitHub API integration test suite
|
515
|
+
./specs/tests/run-github-api-tests.sh
|
516
|
+
|
517
|
+
# Run with specific options
|
518
|
+
./specs/tests/run-github-api-tests.sh --verbose --auto-cleanup
|
519
|
+
----
|
520
|
+
|
521
|
+
The GitHub API test suite validates:
|
522
|
+
|
523
|
+
* Authentication and connectivity
|
524
|
+
* Issue creation with various configurations
|
525
|
+
* Milestone/version management and automation
|
526
|
+
* Label/tag management and automation
|
527
|
+
* Assignment functionality
|
528
|
+
* Automation flags (`--auto-metadata`, `--auto-versions`, etc.)
|
529
|
+
* Error handling and edge cases
|
530
|
+
|
531
|
+
[[contributing]]
|
532
|
+
=== Contributing
|
533
|
+
|
534
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/DocOps/issuer.
|
535
|
+
|
536
|
+
== Legal
|
537
|
+
|
538
|
+
The gem is available as open source under the terms of the MIT License.
|
539
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
6
|
+
t.pattern = 'specs/tests/rspec/**/*_spec.rb'
|
7
|
+
end
|
8
|
+
|
9
|
+
task :default => :spec
|
10
|
+
|
11
|
+
desc "Setup Vale styles"
|
12
|
+
task :vale_setup do
|
13
|
+
sh "vale sync"
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Run documentation quality checks"
|
17
|
+
task :quality => :vale_setup do
|
18
|
+
sh "vale --no-exit --output=line *.adoc examples/*.adoc specs/tests/*.adoc || true"
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Run CLI tests"
|
22
|
+
task :cli_test do
|
23
|
+
puts "Testing CLI functionality..."
|
24
|
+
sh "ruby -Ilib exe/issuer --version"
|
25
|
+
sh "ruby -Ilib exe/issuer --help"
|
26
|
+
sh "ruby -Ilib exe/issuer examples/minimal-example.yml --dry"
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Validate YAML examples"
|
30
|
+
task :yaml_test do
|
31
|
+
puts "Validating YAML examples..."
|
32
|
+
Dir.glob("examples/*.yml").each do |file|
|
33
|
+
puts "Validating #{file}"
|
34
|
+
begin
|
35
|
+
YAML.load_file(file)
|
36
|
+
puts "ā #{file} is valid"
|
37
|
+
rescue => e
|
38
|
+
puts "ā #{file} failed: #{e.message}"
|
39
|
+
exit 1
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "Run bundle install"
|
45
|
+
task :install do
|
46
|
+
sh "bundle install"
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Run all PR tests locally (same as GitHub Actions)"
|
50
|
+
task :pr_test do
|
51
|
+
puts "š Running all PR tests locally..."
|
52
|
+
puts "\n=== RSpec Tests ==="
|
53
|
+
Rake::Task[:spec].invoke
|
54
|
+
|
55
|
+
puts "\n=== CLI Tests ==="
|
56
|
+
Rake::Task[:cli_test].invoke
|
57
|
+
|
58
|
+
puts "\n=== YAML Validation ==="
|
59
|
+
Rake::Task[:yaml_test].invoke
|
60
|
+
|
61
|
+
puts "\n=== Documentation Quality ==="
|
62
|
+
Rake::Task[:quality].invoke
|
63
|
+
|
64
|
+
puts "\nā
All PR tests passed!"
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "Build and install gem locally"
|
68
|
+
task :install_local => :build do
|
69
|
+
sh "gem install pkg/issuer-*.gem"
|
70
|
+
end
|
data/bin/console
ADDED
File without changes
|
data/bin/issuer
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Development setup script for issuer gem
|
4
|
+
# This script helps set up the development environment
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
7
|
+
require_relative '../lib/issuer'
|
8
|
+
|
9
|
+
# Add the lib directory to the load path for development
|
10
|
+
$LOAD_PATH.unshift File.join(__dir__, '..', 'lib')
|
11
|
+
|
12
|
+
# Run the CLI
|
13
|
+
Issuer::CLI.start(ARGV)
|
data/bin/setup
ADDED
File without changes
|
@@ -0,0 +1,56 @@
|
|
1
|
+
= IMYML Examples
|
2
|
+
|
3
|
+
This directory contains example IMYML (Issue YAML) files demonstrating various features of the issuer CLI tool.
|
4
|
+
|
5
|
+
== Files
|
6
|
+
|
7
|
+
=== `basic-example.yml`
|
8
|
+
Demonstrates core IMYML features:
|
9
|
+
|
10
|
+
* Basic meta configuration
|
11
|
+
* Issue properties (summ, body, tags, user, vrsn)
|
12
|
+
* Default values and overrides
|
13
|
+
|
14
|
+
=== `advanced-stub-example.yml`
|
15
|
+
Shows advanced features:
|
16
|
+
|
17
|
+
* Stub functionality with head/tail/body composition
|
18
|
+
* Tag logic with `+` prefix for append-to-all behavior
|
19
|
+
* Mixed scalar string and structured issues
|
20
|
+
* Conditional stub application
|
21
|
+
|
22
|
+
=== `minimal-example.yml`
|
23
|
+
Minimal example for quick testing:
|
24
|
+
|
25
|
+
* Minimal meta configuration
|
26
|
+
* Mix of structured and string issues
|
27
|
+
|
28
|
+
=== `validation-test.yml`
|
29
|
+
For testing milestone and label validation:
|
30
|
+
|
31
|
+
* Issues with non-existent milestones
|
32
|
+
* Issues with non-existent labels
|
33
|
+
* Triggers interactive validation prompts
|
34
|
+
|
35
|
+
=== `new-project-issues.yml`
|
36
|
+
Comprehensive bootstrap issues for new software projects:
|
37
|
+
|
38
|
+
* Repository and infrastructure setup tasks
|
39
|
+
* Development environment configuration
|
40
|
+
* Testing and security framework setup
|
41
|
+
* Common project management tasks
|
42
|
+
* Mix of detailed and simple issue definitions
|
43
|
+
|
44
|
+
== Usage
|
45
|
+
|
46
|
+
Test any example with a dry run:
|
47
|
+
|
48
|
+
issuer examples/basic-example.yml --dry
|
49
|
+
|
50
|
+
Or with the Docker image:
|
51
|
+
|
52
|
+
docker run -it --rm -v $(pwd):/workdir docopslab/issuer issuer examples/basic-example.yml --dry
|
53
|
+
|
54
|
+
== Creating Your Own
|
55
|
+
|
56
|
+
Copy and modify any of these examples as a starting point for your own project's issue definitions.
|