get-upstream-info

Extract upstream GitHub repository identifiers and derived service keys using the gh CLI.

8|7|Updated Feb 14, 2023
One-click install
npx skills add https://github.com/eclipse-slm/slm --skill get-upstream-info-eclipse-slm
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: get-upstream-info
Source: https://github.com/eclipse-slm/slm/tree/main/.agents/skills/get-upstream-info
Command: npx skills add https://github.com/eclipse-slm/slm --skill get-upstream-info-eclipse-slm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When working with forks or shared CI/CD pipelines, scripts often need the canonical upstream repository path rather than the local fork, plus derived identifiers like SonarCloud project keys. Manually parsing git remotes is error-prone across HTTPS and SSH URL formats. ## Core Features & Use Cases - Upstream Detection: Uses gh repo view to determine the parent repository for forks or the current repository for direct clones. - Identifier Derivation: Generates SonarCloud project keys, GitHub API paths, and repository URLs from the upstream path. - Structured Output: Returns machine-readable variables (UPSTREAM_ORG, UPSTREAM_PATH, SONARCLOUD_KEY, IS_FORK) for consumption by other skills. - Use Case: A release automation skill needs the SonarCloud project key and target repository for a pull request; it invokes this skill once, caches the result, and reuses the identifiers across the workflow. ## Quick Start Ask the assistant to determine the upstream GitHub repository and SonarCloud project key for the current repository.

Frequently Asked Questions about get-upstream-info

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find the upstream repository of a GitHub fork?▼

Run gh repo view --json parent,nameWithOwner,name,owner to retrieve the parent repository. If the parent field is not null, the repository is a fork and the parent owner and name give the upstream path.

How to derive a SonarCloud project key from a GitHub repository?▼

Replace the slash in the full repository path with an underscore. For example, ansible-collections/amazon.aws becomes ansible-collections_amazon.aws, which matches the SonarCloud project key format.

Why use gh CLI instead of parsing git remote URLs?▼

The gh CLI queries GitHub's API directly, so it accurately detects fork parent relationships without parsing HTTPS or SSH remote URL formats. It also provides clearer error messages for authentication and availability issues.

What happens if gh CLI is not installed or authenticated?▼

The skill checks for gh in PATH and verifies authentication before querying. If gh is missing it instructs installation from cli.github.com, and if unauthenticated it directs the user to run gh auth login.

Should upstream repository info be cached during a workflow?▼

Yes, the upstream repository does not change within a session, so the result should be cached and reused across skills. This reduces gh API calls, respects rate limits, and keeps identifiers consistent across the workflow.