Packages

Project repository template to set up all public Phoenix projects at Nimble

Retired package: Renamed - Rename to nimble_template

Current section

Files

Jump to
nimble_phx_gen_template lib nimble.phx.gen.template addons github.ex
Raw

lib/nimble.phx.gen.template/addons/github.ex

defmodule Nimble.Phx.Gen.Template.Addons.Github do
use Nimble.Phx.Gen.Template.Addon
@versions %{
otp_version: "23.0.2",
elixir_version: "1.10.4"
}
@impl true
def do_apply(%Project{} = project, opts) when is_map_key(opts, :github_template) do
files = [
{:text, Path.join([".github", "ISSUE_TEMPLATE.md"]),
Path.join([".github", "ISSUE_TEMPLATE.md"])},
{:text, Path.join([".github", "PULL_REQUEST_TEMPLATE.md"]),
Path.join([".github", "PULL_REQUEST_TEMPLATE.md"])}
]
Generator.copy_file(files)
project
end
@impl true
def do_apply(%Project{web_project?: web_project?} = project, opts)
when is_map_key(opts, :github_action) do
binding = [
otp_version: @versions.otp_version,
elixir_version: @versions.elixir_version,
web_project?: web_project?
]
files = [
{:eex, ".github/workflows/test.yml.eex", ".github/workflows/test.yml"}
]
Generator.copy_file(files, binding)
project
end
end