Skip to content

fix: add platform detection for PR/MR creation (issue #1609)#1728

Open
ElizioMartins wants to merge 1 commit into
obra:devfrom
ElizioMartins:fix/platform-detection-pr
Open

fix: add platform detection for PR/MR creation (issue #1609)#1728
ElizioMartins wants to merge 1 commit into
obra:devfrom
ElizioMartins:fix/platform-detection-pr

Conversation

@ElizioMartins

Copy link
Copy Markdown

Who is submitting this PR?

Field Value
Your model + version Nemotron 3 Ultra (via OpenCode)
Harness + version OpenCode (latest)
All plugins installed superpowers
Human partner who reviewed this diff Elizio Martins

What problem are you trying to solve?

Issue #1609: The finishing-a-development-branch skill hardcoded gh pr create for Option 2 (Push and Create PR) without first checking whether the repo is actually hosted on GitHub. On any other platform (GitLab, Bitbucket, self-hosted), gh fails with a confusing error and no PR/MR is created.

What does this PR change?

Adds platform detection before creating PR/MR:

  1. Gets git remote get-url origin
  2. If URL contains "github.com" → uses gh pr create
  3. If URL contains "gitlab" or "gitlab.com" → uses glab mr create
  4. Otherwise → echoes manual instructions with fallback URL

Also includes the issue-closing keywords template (Closes #<issue-number>) in both GitHub and GitLab templates.

Is this change appropriate for the core library?

Yes - this affects all users creating PRs/MRs via the skill, regardless of project domain or Git hosting platform.

What alternatives did you consider?

  • Auto-detect from multiple remotes (origin only for simplicity)
  • Support Bitbucket/Gitea/Gogs (can be added incrementally)
  • The fallback to manual URL covers all unsupported platforms

Does this PR contain multiple unrelated changes?

No - single cohesive change adding platform detection to PR/MR creation.

Existing PRs

  • I have reviewed all open AND closed PRs for duplicates or prior art
  • Related PRs: None found for this specific fix

Environment tested

Harness Harness version Model Model version/ID
OpenCode latest Nemotron 3 Ultra nemotron-3-ultra-free

Evaluation

Rigor

  • This change was tested adversarially, not just on the happy path
  • I did not modify carefully-tuned content (Red Flags table, rationalizations, "human partner" language)

Human review

  • A human has reviewed the COMPLETE proposed diff before submission

- Detect hosting platform from git remote URL before creating PR/MR
- Use 'gh pr create' for GitHub repos
- Use 'glab mr create' for GitLab repos
- Fall back to manual URL for unknown platforms
- Includes issue-closing keywords template (Closes #xxx)

Fixes the bug where 'gh pr create' was hardcoded and failed on GitLab/Bitbucket/self-hosted repos.
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