Issue forms, PR templates, labels & milestones
Ask for the right information once, in a structure, every time
The problem
A typical bug report on an internal R package says “km_plot is broken”. You then spend three messages collecting the R version, the package version, the data shape and what “broken” means. Feature requests arrive with no acceptance criteria, so nobody can say when they’re done. PRs arrive with no tests, no NEWS.md bullet and undocumented arguments.
GitHub can ask for all of this up front. The same structure also gives you traceability, which GxP work needs anyway: requirement → issue → PR → test → release.
Issue forms (YAML) vs issue templates (Markdown)
GitHub has two kinds of issue template in .github/ISSUE_TEMPLATE/:
Markdown template (*.md) |
Issue form (*.yml) |
|
|---|---|---|
| What the reporter sees | A pre-filled text box they can overwrite | Real form fields: text areas, inputs, dropdowns, checkboxes |
| Required fields | No; headings get deleted | Yes, with validations: required: true |
| Code/log fields | Reporter must add backticks | render: r formats the field as a code block automatically |
| Auto labels | Yes | Yes |
usethis::use_tidy_github() creates the Markdown kind (issue_template.md). It’s a fine start, but forms are the upgrade: required fields can’t be skipped.
GitHub’s documentation still labels issue forms as public preview. After adding them, open …/issues/new/choose in your repo to check that they render.
The web-repo way
Three small files:
# .github/ISSUE_TEMPLATE/config.yml: force people to pick a form
blank_issues_enabled: false# .github/ISSUE_TEMPLATE/feature.yml (abridged)
name: Feature request
description: A new page, section, capability or standard
labels: ["type: feature"]
body:
- type: textarea
id: problem
attributes: { label: Problem or goal }
validations: { required: true }
- type: textarea
id: acceptance
attributes:
label: Acceptance criteria
description: Testable conditions that mean this is done.
validations: { required: true }Add a .github/PULL_REQUEST_TEMPLATE.md with What / Why / Closes #… / Checklist, plus a label taxonomy and milestones with exit criteria:
gh label create "type: bug" --color d73a4a --description "Something is broken"
gh label create "area: ci" --color 1d76db --description "GitHub Actions, hooks, release tooling"
gh api repos/OWNER/REPO/milestones -f title="M2 Static site" \
-f description="Exit: Lighthouse >= 95; 0 broken links; form returns 400 on invalid input"Prefixed labels (type: …, area: …) group nicely in GitHub’s label picker and in filters (label:"type: bug" label:"area: ci").
The R way
Drop-in files for R packages and Shiny apps are catalogued in templates/README.md, including:
templates/github/ISSUE_TEMPLATE/config.ymlto disable blank issues and require formstemplates/github/ISSUE_TEMPLATE/bug.ymlfor reproducible bug reportstemplates/github/ISSUE_TEMPLATE/feature.ymlfor feature requests with acceptance criteriatemplates/github/PULL_REQUEST_TEMPLATE.mdfor pull request reviews
Bug form: reprex and session info are required
The complete bug form template is provided in templates/github/ISSUE_TEMPLATE/bug.yml:
bug.yml
name: Bug report
description: Something in the package or app does not work as documented
labels: ["type: bug"]
body:
- type: markdown
attributes:
value: |
Thanks! Please use **synthetic or public data only**. Never paste real patient or client data.
- type: textarea
id: what
attributes:
label: What happened, and what did you expect?
validations:
required: true
- type: textarea
id: reprex
attributes:
label: Reproducible example
description: Ideally the output of `reprex::reprex()`. For Shiny apps, the steps to reproduce.
render: r
validations:
required: true
- type: textarea
id: session
attributes:
label: Session info
description: Output of `sessioninfo::session_info()` (or `sessionInfo()`).
render: text
validations:
required: true
- type: input
id: where
attributes:
label: Where did you see it?
placeholder: "local R 4.5.1 / Posit Connect / shinyapps.io / browser + version" - type: textarea
id: reprex
attributes:
label: Reproducible example
description: Ideally the output of `reprex::reprex()`. For Shiny apps, the steps to reproduce.
render: r
validations: { required: true }
- type: textarea
id: session
attributes:
label: Session info
description: Output of `sessioninfo::session_info()` (or `sessionInfo()`).
render: text
validations: { required: true }The form also opens with a reminder to use synthetic or public data only. In pharma, that sentence prevents a real incident.
Feature form: acceptance criteria become tests
The feature form has a required Acceptance criteria field and an optional Requirement ID field (for example URS-042). Write the criteria so each one maps to an expect_*() call or a shinytest2 snapshot. The issue then traces requirement → test, which is exactly what a validation reviewer asks for.
PR template: the R definition of done
- [ ] `devtools::check()` clean (0 errors, 0 warnings, notes explained)
- [ ] Tests added or updated (`testthat` / `shinytest2`)
- [ ] `devtools::document()` run; roxygen docs updated
- [ ] `NEWS.md` bullet added (user-facing changes only)
- [ ] Code styled (`air format .` or `styler`) and `lintr::lint_package()` clean
- [ ] No secrets, tokens or real patient/client data in the diffLabels from R
usethis can manage labels without leaving R:
usethis::use_github_labels(
labels = c("type: bug", "type: feature", "area: shiny", "area: validation"),
colours = c("type: bug" = "d73a4a", "type: feature" = "0e8a16",
"area: shiny" = "c5def5", "area: validation" = "5319e7")
)
# or the tidyverse's standard set:
usethis::use_tidy_github_labels()Keep .github/ out of the package
usethis::use_build_ignore(".github") # adds ^\.github$ to .RbuildignoreMilestones: releases with exit criteria
In an R package, a milestone is naturally a release (v1.3.0), and its description is the release’s exit criteria: which issues, and what checks must pass. Closing the milestone is part of cutting the release (releases & changelogs). For a Shiny app, a milestone can be a deployment (“UAT build for study X”).
Pitfalls
- Create labels before forms reference them. GitHub’s docs don’t say what happens with a missing label, so don’t rely on it. Create the taxonomy first and check that a test issue gets its label.
blank_issues_enabled: falsedoesn’t stop maintainers. Per GitHub’s docs, users with write access or above still see a “Blank issue (Maintainers only)” option. Only Read/Triage users are limited to the forms. Addcontact_linksto route questions, for example to Discussions.- Checklists aren’t enforcement. The PR template reminds; CI enforces (
R CMD check, CI with GitHub Actions). Don’t rely on ticked boxes. - Don’t over-ask. Every required field is friction. Keep bug forms to what you truly need.
Sources
GitHub
- Issue forms syntax (documented as public preview): GitHub Docs: Syntax for issue forms
- Configuring issue templates (
blank_issues_enabled; write-access users still see “Blank issue (Maintainers only)”): GitHub Docs: Configuring issue templates for your repository - Milestones: GitHub Docs: About milestones
- Labels: GitHub Docs: Managing labels
gh label create: cli.github.com/manual/gh_label_create
R package documentation
- usethis (
use_tidy_github(),use_github_labels(),use_tidy_github_labels(),use_build_ignore()): usethis.r-lib.org - reprex: reprex.tidyverse.org
- sessioninfo: sessioninfo.r-lib.org
- shinytest2: rstudio.github.io/shinytest2
- 2026-09-26: Removed the end-of-post checklist.
- 2026-09-27: Added a Sources section.
- 2026-09-27: Linked every template file and showed it on the page.