agentleFS
redhat-developerredhat-developer/rhdh-skills/skills/ci/rhdh-pr-mr/SKILL.md

rhdh-pr-mr

Skill20 starsChanged 20 days agoApache-2.0View on GitHub

Pushes a topic branch and opens a GitHub pull request or GitLab CEE merge request for CI and agent automation after validating AI/tool attribution and a linked Jira issue in its description, then links Jira via /rhdh-jira-link. Use for "open a PR", "create the merge request", "push and open PR/MR after a yarn or base-image bump", or when another CI skill needs a shared opener. Not for plugin changeset publish (/rhdh-pr-create) and not a replacement for midstream createPR.sh inside updateBaseImages.sh.

  • Commits and pushes

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Always opens rebased to the tip: Before pushing, the script fetches the remote topic branch (when it exists) and the target branch — from …

    line 28
  2. Very specific:

    Default is --no-open (no browser).

    line 53
  3. Very specific:

    If --attribution is omitted, the script falls back to PI_MODEL and PI_REASONING_LEVEL (pi (<model>, thinking: <level>)) before failing.

    line 75
  4. Very specific:

    Before pushing, the script verifies that the latest commit carries an attribution trailer.

    line 83
  5. Very specific:

    Follow /mutation-gate for push + open + Jira link.

    line 111

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

RHDH PR / MR opener

Shared script for push + open. Caller owns the commit and /mutation-gate approval when an agent is driving. Weekly bots may call the script unattended.

Boundaries

  • Not /rhdh-pr-create (plugin changesets, recordings, monorepo publish).
  • Requires a known Jira key and calls /rhdh-jira-link after opening. Stop before pushing when no issue is known; never invent one.
  • Requires an attribution trailer on the commit and in the description. The payload is open: name the tool, then add only the agent, model, provider and thinking level that are actually known.
  • Midstream createPR.sh (distgit) stays for updateBaseImages.sh until a later migration.
  • Always opens rebased to the tip. Before pushing, the script fetches the remote topic branch (when it exists) and the target branch — from origin, or from an upstream remote when origin is a fork that lacks the target — rebases onto both, and refuses to push a HEAD that is still behind the base tip. A rebase that rewrites an already-pushed topic branch is followed by a single named --force-with-lease push; a first push stays a normal git push -u. A conflicted rebase aborts and fails loudly rather than opening a behind-the-base PR/MR.

Script

SKILL=<this skill's directory>
"$SKILL/scripts/create-pr-mr.sh" \
  --cwd /path/to/checkout \
  --base main \
  --head chore/my-topic \
  --title 'chore: short summary' \
  --body-file /tmp/body.md \
  --issue RHIDP-12345 \
  --attribution '<tool> (<agent> + <model> (<provider>), thinking: <level>)' \
  [--label ok-to-test] \
  [--dry-run]

Default is --no-open (no browser). Pass --open only for interactive agent runs. GITLAB_PIPELINE=true forces no browser.

The script appends [<base>] to --title when that suffix is missing, including for main (chore: short summary becomes chore: short summary [main]). A title that already ends with the base branch is left as-is.

Resolve the --attribution value from the current work, filling in whatever is known and stopping there:

KnownValue
tool + agent + model + provider + thinkingpaseo (pi + DeepSeek V4.1 Flash (EnMaaS), thinking: off)
tool + model + thinkingpi (GLM 5.3, thinking: high)
tool onlypi
  • Tool is where the agent ran: paseo, pi, cursor, a CI bot script.
  • Agent, provider, thinking level are optional and go in that order; thinking: is a labelled field, not a third model word.
  • Never guess and never emit a placeholder. A missing model is dropped, not filled with a stand-in string that the next agent will copy verbatim. No Unknown AI, no invented version numbers, no borrowed IDE name.
  • If --attribution is omitted, the script falls back to PI_MODEL and PI_REASONING_LEVEL (pi (<model>, thinking: <level>)) before failing.
  • The trailer key written is Assisted-By:; Generated-by: is accepted on read, so older callers and existing commits keep working. A value that already starts with either key is used verbatim.
  • --assisted-by and RHDH_ASSISTED_BY remain accepted as aliases of --attribution and RHDH_ATTRIBUTION.

Before pushing, the script verifies that the latest commit carries an attribution trailer. Any payload satisfies it — the commit trailer and the --attribution value do not have to match, so a caller can pass less detail than the commit has. The script adds the resolved line (when the description has none) and Related Jira: [KEY](https://redhat.atlassian.net/browse/KEY) to the PR/MR description.

GitLab MRs set remove_source_branch: true so merging deletes the topic branch.

Stdout includes url: …. Exit 0 if a PR/MR already exists for --head.

Jira

ConditionBehavior
--issue KEY or JIRA_ISSUE set + JIRA_API_TOKENAdd the linked issue to the description, then invoke /rhdh-jira-link (link-pr-mr.js link). The Jira comment links the PR/MR title (repo #id: title [base]) to the URL (plus optional Adjusted fields).
Issue set but no token / missing link scriptThe linked description remains; warn that the Jira backlink was skipped.

Override the link scripts directory with RHDH_JIRA_LINK_SCRIPTS when the sibling skill is not next to this one in the pack checkout.

Agents

  1. Resolve the most specific available attribution from the table above — fill in what you know, stop at the tool name — and add that Assisted-By: trailer to the commit.
  2. Resolve the Jira key from the conversation. Stop before pushing when none is known; never turn a plain issue key in the description into an unlinked label.
  3. Follow /mutation-gate for push + open + Jira link.
  4. Invoke /rhdh-pr-mr by name (or run the script path when already inside a skill clone), passing --issue and --attribution.
  5. Report the url: line.

Tests

bash -n "$SKILL/scripts/create-pr-mr.sh"
shellcheck --severity=warning "$SKILL/scripts/create-pr-mr.sh"
"$SKILL/scripts/create-pr-mr.sh" --help
"$SKILL/tests/smoke.sh"

Completion

Done when the topic branch is pushed; the latest commit and PR/MR description carry an attribution trailer whose payload names every part that was actually known; the description contains the Markdown Jira link; a Jira Web link was updated or its missing credential was reported; and a GitLab MR is configured to delete its source branch after merge.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.