Skip to content

Add GitHub issue types support with GraphQL integration - #20

Merged
briandominick merged 3 commits into
release/0.2.0from
feature/add-type-property-to-issue-mapping
Jul 16, 2025
Merged

Add GitHub issue types support with GraphQL integration#20
briandominick merged 3 commits into
release/0.2.0from
feature/add-type-property-to-issue-mapping

Conversation

@briandominick

@briandominick briandominick commented Jul 16, 2025

Copy link
Copy Markdown
Contributor

This PR adds support for GitHub issue types with GraphQL integration and fallback behavior.

GraphQL Note

The type property of GitHub issues is relatively new, and it has not yet been implemented in the REST API. At first I thought it was just not documented, but after some experimentation I'm confident it is not there for write (POST/PUT/DELETE) operations, though it is returned in GET requests for issues.

The GraphQL API does support assigning types to issues, so I have implemented it that way. This does mean having a single operation (method: Issuer::APIs::GitHub::Client.create_issue_with_type) that engages the GraphQL API.

When I add Jira support, we'll be using REST, so there's no reason to scrap REST altogether. However, it is tempting to switch to GraphQL for all GH operations. For now, this quirky fix is what I decided was called for. If the GraphQL operation fails, the fallback is to REST with a type:<type> label added to rescue the operation. This technically means using type: Task or type: Anything in an IMML document is a way to arbitrarily assign type:-keyed labels, but there is really no advantage to that over just adding a label type:Task or whatever.

Changes

Core Features

  • Added type attribute to Issue model for issue type specification in IMYML files
  • Implemented GraphQL support in GitHub API client for issue creation when type field is specified
  • Added fallback to REST API when type field is omitted or GraphQL creation fails
  • Enhanced GitHub site adapter to handle type field in parameters and display

GraphQL Integration

  • Manual GraphQL implementation using direct HTTP POST requests (compatible with current Octokit version)
  • Helper methods for resolving repository ID, issue types, and user IDs via GraphQL
  • Fallback behavior: adds type label if GraphQL fails or issue type not found

Testing & Documentation

  • Comprehensive RSpec tests covering type field support, case-insensitive matching, and fallback behavior
  • Updated README.adoc with documentation for new type field and constraints
  • All 82 tests passing with detailed coverage of new functionality

User Experience

  • Dry-run display includes type field information
  • Case-insensitive type matching for better usability
  • Graceful fallback maintains compatibility with existing workflows

This feature maintains maximum compatibility with GitHub's current issue model while adding flexible issue typing support within the Issuer tool.

- Add 'type' field to Issue model with defaults support
- Create GitHub API client with GraphQL query support using HTTP requests
- Add hybrid API approach: GraphQL for issues with types, REST for others
- Implement case-insensitive type matching (bug, BUG, Bug all work)
- Add graceful fallback from GraphQL to REST API on errors
- Add type label fallback: creates 'type:<type>' label when GraphQL fails
- Support type field in GitHub site adapter parameter conversion
- Remove redundant repository field from dry-run output formatting
- Add type display in formatted output when present
- Add 'type' field to IMYML format examples and property reference
- Document type field in defaults and individual issue records
- Add 11 new tests in issue_spec.rb for type field behavior and site integration
- Add 4 tests for type model support (defaults, preferences, nil handling)
- Add 4 tests for GitHub site adapter type parameter conversion
- Add 3 tests for dry-run display formatting with types
- Add 2 tests in ops_spec.rb for case-insensitive type matching logic
@briandominick
briandominick merged commit 4e3745f into release/0.2.0 Jul 16, 2025
6 checks passed
briandominick added a commit that referenced this pull request Aug 7, 2025
* Bump version to 0.2.0
* Ignore local AI scratch path
* Clean up .gitignore
* fix: correct examples link path in README
* chore: update Gemfile.lock for version 0.2.0
* Add GitHub issue types support with GraphQL integration (#20)
* doc: add issue types support to IMYML documentation
* test: add comprehensive test coverage for issue types feature
* fix: 'JIRA'->'Jira' references (#23)
* Add capability to override default tags on a per-issue basis (#24)
* add: tag removal functionality with - prefix at issue level
* test: add comprehensive tests for tag removal functionality
* doc: add tag removal example to README
* Fix long-line wrapping in dry-run output with maintained indentation (#25)
* Docs/issues README review and GemDocs links (#30)
* Remove -v and --tokenv from CLI help (#31)
* Remove parentheses around method def args
* Updated examples to include types
* Add ReleaseHx functionality for generating release notes/changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant