Skip to content

Add GitHub issue creation endpoint via REST POST with dynamic auth token handling - #658

Open
conorheffron with Copilot wants to merge 8 commits into
mainfrom
copilot/integrate-github-post-issue-api
Open

Add GitHub issue creation endpoint via REST POST with dynamic auth token handling#658
conorheffron with Copilot wants to merge 8 commits into
mainfrom
copilot/integrate-github-post-issue-api

Conversation

Copilot AI commented May 16, 2026

Copy link
Copy Markdown
Contributor

This PR adds backend support for creating GitHub issues through the GitHub REST API (POST /repos/{owner}/{repo}/issues) and addresses the prerequisite for dynamic token handling in POST calls. It extends the existing read-only issue integration with a write path while preserving existing URL safety checks.

  • API surface: add create-issue endpoint

    • Added POST /api/create-repo-issue/{username}/{repository}/ in GitProjectsController.
    • Added request validation for path params and required issue title.
    • Maps create request payload into the existing issue response shape.
  • Service layer: orchestrate issue creation

    • Added createIssue(userId, repo, requestBody) to GitDetails/GitDetailsService.
    • Reuses configured GitHub issues endpoint template and URI expansion.
    • Introduced named constants for pagination placeholders used by endpoint expansion.
  • GitHub client: implement POST call

    • Added createGitHubIssue(...) to Client/GitClient.
    • Sends GitHub-required headers for issue creation:
      • Accept: application/vnd.github+json
      • X-GitHub-Api-Version: 2022-11-28
      • Content-Type: application/json
    • Serializes request payload and deserializes created issue response.
  • Auth and outbound hardening

    • Normalized Authorization header construction to support raw tokens and already-prefixed bearer tokens.
    • Tightened connection URL validation (protocol/host/port match) before opening outbound connection.
  • Data model additions

    • Added RepositoryIssueCreateDomain and RepositoryIssueCreateDto with support for:
      • title, body, assignees, milestone, labels
@PostMapping(value = {"/create-repo-issue/{username}/{repository}/"},
        consumes = MediaType.APPLICATION_JSON_VALUE,
        produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RepositoryIssueDomain> createIssueByUsernameAndRepoPathVars(
        HttpServletRequest request,
        @PathVariable("username") String username,
        @PathVariable("repository") String repository,
        @RequestBody RepositoryIssueCreateDomain issue) {
    return createIssueByUsernameAndRepo(request, username, repository, issue);
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • ads.mozilla.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette -headless -no-remote -profile /tmp/rust_mozprofileADoJkb (dns block)
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette --headless --disable-gpu --window-size=1920,1080 -no-remote -profile /tmp/rust_mozprofile7wbbDC (dns block)
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette --headless --disable-gpu --window-size=1920,1080 -no-remote -profile /tmp/rust_mozprofileTWSiKv (dns block)
  • detectportal.firefox.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette -headless -no-remote -profile /tmp/rust_mozprofileADoJkb (dns block)
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette --headless --disable-gpu --window-size=1920,1080 -no-remote -profile /tmp/rust_mozprofile7wbbDC (dns block)
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette --headless --disable-gpu --window-size=1920,1080 -no-remote -profile /tmp/rust_mozprofileTWSiKv (dns block)
  • firefox.settings.services.mozilla.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette -headless -no-remote -profile /tmp/rust_mozprofileADoJkb (dns block)
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette --headless --disable-gpu --window-size=1920,1080 -no-remote -profile /tmp/rust_mozprofile7wbbDC (dns block)
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette --headless --disable-gpu --window-size=1920,1080 -no-remote -profile /tmp/rust_mozprofileTWSiKv (dns block)
  • ironoc.net
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette -headless -no-remote -profile /tmp/rust_mozprofileADoJkb (dns block)
  • support.mozilla.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette --headless --disable-gpu --window-size=1920,1080 -no-remote -profile /tmp/rust_mozprofile7wbbDC (dns block)
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette --headless --disable-gpu --window-size=1920,1080 -no-remote -profile /tmp/rust_mozprofileTWSiKv (dns block)
  • www.ironoc.net
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox --marionette -headless -no-remote -profile /tmp/rust_mozprofileADoJkb (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI linked an issue May 16, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Integrate GitHub POST issue API call Add GitHub issue creation endpoint via REST POST with dynamic auth token handling May 16, 2026
@conorheffron conorheffron added java-be Java / Server Side Tasks java Pull requests that update Java code labels May 16, 2026
@conorheffron
conorheffron marked this pull request as ready for review May 16, 2026 14:56
@conorheffron

Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

Comment thread src/main/java/net/ironoc/portfolio/client/GitClient.java

Copilot AI commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Conflicts are resolved on this branch. It is up to date with origin/main (git merge origin/main reports "Already up to date") and the merge-resolution commit is ac35606.

…forgery'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code java-be Java / Server Side Tasks

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

Integrate GitHub POST issue API call

4 participants