All skills
getsentry avatar

/pr-link-issue

@ccf58b1 official
by Sentrygetsentry/skills1k stars
53

Append a GitHub issue link and its Linear ticket to the current PR's description. Use when asked to "link issue to pr", "fill in issue and linear in pr", "add issue refs to pr", or when given a GitHub issue URL and asked to attach it to the current PR. Resolves the Linear ticket automatically from the issue's linear-linkback comment.

Use this Skill: https://skilld.dev/gh/getsentry/skills/pr-link-issue

This session only. Nothing lands on disk.

SKILL.md

β‰ˆ88 tokens always: the name and description. β‰ˆ589 when used: this file.

Link a GitHub Issue + Linear Ticket on a PR

Appends a Sentry-style #### Issues block to a PR description, referencing both the GitHub issue and the Linear ticket pulled from the issue's linear-linkback comment.

Inputs

  • <issue-url> β€” GitHub issue URL like https://github.com/<owner>/<repo>/issues/<n>. Issue number alone is fine if the PR is in the same repo.
  • (optional) <pr-number> β€” defaults to the open PR for the current branch.

Steps

  1. Resolve the PR number β€” skip if user supplied one:

    gh pr view --json number,body -q '.number'

    If no PR exists on the branch, stop and tell the user.

  2. Extract issue number + repo from the input URL, or accept a bare #1234 for current repo.

  3. Fetch the Linear ticket from the issue's linear-linkback comment:

    gh issue view <n> --repo <owner>/<repo> --json comments \
      -q '.comments[] | select(.author.login=="linear-code") | .body' \
      | grep -Eioe '[a-z]+-[0-9]+' | head -1

    If no match, fall back to asking the user for the Linear key, or omit it.

  4. Read the existing PR body so you can append rather than overwrite:

    gh pr view <pr-number> --json body -q '.body'
  5. Construct the new body. If the body is empty, use just the #### Issues block. Otherwise, append it after a blank line. Don't duplicate β€” if #### Issues is already present, replace that section instead of adding a second one.

    Format:

    #### Issues
    
    * Resolves: #<n>
    * Resolves: <linear-key>
  6. Update the PR with a heredoc to preserve newlines:

    gh pr edit <pr-number> --body "$(cat <<'EOF'
    <new body>
    EOF
    )"
  7. Confirm by echoing the resulting PR URL:

    gh pr view <pr-number> --json url -q '.url'

Notes

  • Linear linkback comments are posted by the GitHub user linear-code. The body contains a markdown link whose text is the Linear key, e.g. PY-2357.
  • Project keys vary per repo (PY-… for sentry-python, JS-… for sentry-javascript, etc.) β€” the regex [a-z]+-[0-9]+ covers them.
  • Don't strip existing PR content. Always read first, append/replace second.
  • If the issue doesn't have a Linear linkback yet (newly filed), proceed with just the GitHub issue reference and tell the user the Linear key is missing.

Source: SKILL.md on GitHub

1 warning16d3 checks Β· Risk SAFE
  • Gen Agent Trust Hub16d

    The skill automates linking GitHub issues and Linear tickets within Pull Request descriptions using the GitHub CLI. It contains a standard risk surface for indirect prompt injection because it ingests untrusted text directly from PR bodies and issue comments.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: MEDIUM Β· 1 issue

Signed by skilld at ccf58b1. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 months ago
  • github
  • pr
  • issue
  • linear
  • sentry
  • automation

README badge

README badge for getsentry/skills/pr-link-issue

Appends a GitHub issue link and its Linear ticket to a PR description, extracting the Linear key from the issue's linear-linkback comment. Use when asked to link an issue to a PR or given a GitHub issue URL to attach to the current PR.

Generated from the current SKILL.md.

What if the issue doesn't have a Linear linkback comment yet?
The skill will proceed with just the GitHub issue reference in the PR description and notify you that the Linear key is missing. You can add it manually later once the Linear ticket is created.
Does this work with issues in a different repository?
Yes. You can pass a full GitHub issue URL like `https://github.com/owner/repo/issues/123`. If the issue is in the same repo as the PR, a bare issue number like `#1234` works too.
What happens if the PR description already has an Issues section?
The skill replaces the existing `#### Issues` block instead of duplicating it, preserving any other content in the PR body.
Can I specify which PR to update, or does it default to the current branch?
You can optionally supply a PR number. If you don't, the skill uses the open PR for your current branch. If no PR exists on the branch, it will stop and ask you to create one first.

Generated from the current SKILL.md. These answers refresh after source changes.