Hotfix deploy

From hmislk/hmis · View interactive version

Hotfix deploy is an AI agent skill from the GitHub repository hmislk/hmis. Full hotfix workflow for deploying urgent fixes to a production branch (coop-production, rh-production, southernlanka-staging, etc.). Covers branch creation, fix, commit, push, and PR targeting the production branch. Use when you need to apply an urgent fix directly to a production environment witho

How to use this skill

Skill file

Hotfix Deployment Workflow

Deploy an urgent fix directly to a production branch.

Arguments

Critical Rule

The branch name MUST end with -hotfix.

CI merge validation will block PRs from branches that do not end with -hotfix.

Step 1 — Stash Any Uncommitted Work

git stash

Step 2 — Create Hotfix Branch from Production

git fetch origin
git checkout -b $1-hotfix origin/$0

Branch name format: <description>-hotfix

Examples:

Step 3 — Apply the Fix

Make only the minimal changes required. Do NOT port unrelated features or refactors.

Before editing persistence.xml, compare against the target production branch to understand the current state:

git show origin/$0:src/main/resources/META-INF/persistence.xml

Step 4 — Pre-Commit Checklist

Note: The persistence.xml on production branches typically uses ${JDBC_DATASOURCE} environment variable placeholders, while the local development persistence.xml has hardcoded JNDI names (e.g., jdbc/coop). Never copy the hardcoded JNDI name into the production branch.

Step 5 — Commit

git add <changed-files>
git commit -m "fix: <description of fix>

<Explanation of why this was needed and what it fixes.>
References issues #NNNN.

Co-Authored-By: Codex <noreply@openai.com>"

Step 6 — Push

git push origin $1-hotfix

Step 7 — Create PR Targeting the Production Branch

gh pr create \
  --title "fix: <description>" \
  --base $0 \
  --head $1-hotfix \
  --body "..."

The PR must target $0 (the production branch), not development or master.

The body is public: state the defect, the fix and the deploy note, and keep the

affected hospital's record counts, production bill numbers, schema names and

data-fix steps out of it. See

What May Go Into a GitHub Issue, PR, or Comment.

Step 8 — Restore Stashed Work

git checkout <your-previous-branch>
git stash pop

Step 9 — Clean Up Old Branch (Post-Merge)

After the PR is merged:

git branch -d $1-hotfix

Common Production Branches

| Hospital/Environment | Branch |

|----------------------|----------------|

| COOP pharmacy | coop-production |

| COOP inward | coop-staging |

| Ruhunu hospital | rh-production |

| Southern Lanka (live)| southernlanka-staging |

Full map: developer_docs/deployment/ci-cd-pipeline-overview.md. CI's -hotfix

head check does not yet run for these targets (#24453); follow the naming rule anyway.

Reference

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.