Skip to content

Commit

Permalink
Add GitHub issue template
Browse files Browse the repository at this point in the history
  • Loading branch information
Virtlink committed Jul 31, 2024
1 parent a261cdf commit 8267f5e
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ object GenerateCommand: CliktCommand(
generator.generateGradleWrapper()
generator.generateGradleRootProject()
generator.generateGithubWorkflows()
generator.generateGithubIssueTemplates()
println("Done!")
}

Expand Down Expand Up @@ -142,6 +143,13 @@ object GenerateCommand: CliktCommand(
}
}

fun generateGithubIssueTemplates() {
val generate = metadata.files.githubIssueTemplates.generate
val update = metadata.files.githubIssueTemplates.update || forceUpdate
generate("github/ISSUE_TEMPLATE/config.yml", generate, update, path = ".github/ISSUE_TEMPLATE/config.yml")
generate("github/ISSUE_TEMPLATE/20-report-a-bug.yml", generate, update, path = ".github/ISSUE_TEMPLATE/20-report-a-bug.yml")
}

private fun generate(templateName: String, generate: Boolean, update: Boolean, path: String = templateName) {
val outputFile = repoDir.resolve(path)
val outputFileExisted = outputFile.exists()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ data class Files(
val gradleRootProject: GradleRootProject = GradleRootProject(),
/** The metadata for the GitHub workflows. */
val githubWorkflows: GithubWorkflows = GithubWorkflows(),
/** The metadata for GitHub issue templates. */
val githubIssueTemplates: GithubIssueTemplates = GithubIssueTemplates(),
)

/** Metadata for the README.md file. */
Expand Down Expand Up @@ -186,6 +188,19 @@ data class GithubWorkflows(
val buildDocs: Boolean = false,
)

/** Metadata for GitHub issue templates. */
@Serializable
data class GithubIssueTemplates(
/** Whether to generate the files. */
val generate: Boolean = true,
/** Whether to update the file. */
val update: Boolean = true,
/** Whether to automatically assign developers to issues. */
val assignDevelopers: Boolean = true,
/** Whether to use the GitHub Discussions tab. */
val useDiscussions: Boolean = true,
)

/** A Maven artifact. */
@Serializable
data class MavenArtifact(
Expand All @@ -209,7 +224,7 @@ data class GradlePlugin(
/** A person. */
@Serializable
data class Person(
/** The ID of the person, usually their GitHub nickname. */
/** The GitHub nickname of the person. */
val id: String? = null,
/** The (full) name of the person. */
val name: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
@import org.metaborg.repoman.meta.RepoMetadata
@param meta: RepoMetadata
---
@if(meta.files.gradleRootProject.update)
# !! THIS FILE WAS GENERATED USING repoman !!
# Modify `repo.yaml` instead and use `repoman` to update this file
# See: https://github.com/metaborg/metaborg-gradle/

@endif
name: "🐞 Report a Bug"
description: File a bug report or issue for any project in ${meta.title}.
title: "[Bug]: "
labels: ["bug", "triage"]
@if(meta.files.githubIssueTemplates.assignDevelopers)
assignees:
@for(person in meta.developers)
- ${person.id}
@endfor
@endif
body:
@if(meta.files.gradleRootProject.includedBuilds.isNotEmpty() || meta.files.gradleRootProject.includedProjects.isNotEmpty())
- type: dropdown
id: project
attributes:
label: For which project in this repository does the issue occur?
multiple: true
options:
@for(project in meta.files.gradleRootProject.includedProjects)
- "${project.name}"
@endfor
@for(build in meta.files.gradleRootProject.includedBuilds)
- "${build.name}"
@endfor
@else
- type: textarea
attributes:
label: Project
description: For which project in this repository does the issue occur?
validations:
required: false
@endif
- type: textarea
attributes:
label: Version
description: The version of Spoofax or the commit of this project where the issue occurs.
validations:
required: false
- type: textarea
attributes:
label: Describe the issue
description: A clear and concise description of what the bug is.
validations:
required: false
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: false
- type: textarea
attributes:
label: Actual Behavior
description: A concise description of what happened instead.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!

Tip: You can attach images, log files, or an example project by clicking this area to highlight it and then dragging files in.
validations:
required: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@import org.metaborg.repoman.meta.RepoMetadata
@param meta: RepoMetadata
---
blank_issues_enabled: false
contact_links:
- name: 📚 Spoofax Documentation
url: https://www.spoofax.dev/
about: Documentation about Spoofax and all included Meta-Languages.
- name: ⁉️ Spoofax Support Page
url: https://www.spoofax.dev/support
about: Information on Spoofax Support, and how to get in touch.
- name: 🙋🏽 Spoofax Users Channel
url: https://slde.slack.com/archives/C7254SF60
about: The Spoofax Users channel on Slack. See the Spoofax Support Page on how to gain access.
@if(meta.files.githubIssueTemplates.useDiscussions)
- name: 💬 Discussions
url: https://github.com/${meta.repoOwner}/${meta.repoName}/discussions/
about: Alternatively, ask questions in the Discussions tab.
@endif
- name: 🛡️ Security issue
url: https://github.com/${meta.repoOwner}/${meta.repoName}/security/advisories/new
about: Security issue? Do not report security issues publicly, but create a private advisory.

0 comments on commit 8267f5e

Please sign in to comment.