Skip to content

Use github api to create feature_request.md when a new repo is created #12

@chrisjsimpson

Description

@chrisjsimpson

Is your feature request related to a problem? Please describe.

We currently use the github api to add release.yml and deploy.yml:

container-hosting/app.py

Lines 223 to 258 in 62592c1

# Create release.yml github workflow
with open("./repo-template-files/.github/workflows/release.yml") as fp:
release_yml = fp.read()
release_yml = release_yml.replace("GITHUB_OWNER", username)
release_yml = release_yml.replace("GITHUB_REPO_NAME", repo_name)
release_yml_b64 = b64encode(release_yml.encode("utf-8")).decode("utf-8")
data = {
"message": "create .release_yml",
"committer": {"name": username, "email": email},
"content": release_yml_b64,
}
req = requests.put(
f"https://api.github.com/repos/{username}/{repo_name}/contents/.github/workflows/release.yml",
headers=headers,
data=json.dumps(data),
)
# Create deploy.yml github workflow
with open("./repo-template-files/.github/workflows/deploy.yml") as fp:
deploy_yml = fp.read()
deploy_yml = deploy_yml.replace("GITHUB_OWNER", username)
# APP_NAME is for dokku, and is currently the same as
# the REPO_NAME.
deploy_yml = deploy_yml.replace("APP_NAME", repo_name)
deploy_yml = deploy_yml.replace("REPO_NAME", repo_name)
deploy_yml_b64 = b64encode(deploy_yml.encode("utf-8")).decode("utf-8")
data = {
"message": "create deploy.yml",
"committer": {"name": username, "email": email},
"content": deploy_yml_b64,
}
req = requests.put(
f"https://api.github.com/repos/{username}/{repo_name}/contents/.github/workflows/deploy.yml",
headers=headers,
data=json.dumps(data),
)

but are missing .github/ISSUE_TEMPLATE/create feature_request.md

Describe the solution you'd like

In the same way release.yml and deploy.yml are created, create .github/ISSUE_TEMPLATE/create feature_request.md

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context

We previously achieved the same thing using bash/clone. This approach uses the github api.

Example of other files being added:

container-hosting/app.py

Lines 223 to 258 in 62592c1

# Create release.yml github workflow
with open("./repo-template-files/.github/workflows/release.yml") as fp:
release_yml = fp.read()
release_yml = release_yml.replace("GITHUB_OWNER", username)
release_yml = release_yml.replace("GITHUB_REPO_NAME", repo_name)
release_yml_b64 = b64encode(release_yml.encode("utf-8")).decode("utf-8")
data = {
"message": "create .release_yml",
"committer": {"name": username, "email": email},
"content": release_yml_b64,
}
req = requests.put(
f"https://api.github.com/repos/{username}/{repo_name}/contents/.github/workflows/release.yml",
headers=headers,
data=json.dumps(data),
)
# Create deploy.yml github workflow
with open("./repo-template-files/.github/workflows/deploy.yml") as fp:
deploy_yml = fp.read()
deploy_yml = deploy_yml.replace("GITHUB_OWNER", username)
# APP_NAME is for dokku, and is currently the same as
# the REPO_NAME.
deploy_yml = deploy_yml.replace("APP_NAME", repo_name)
deploy_yml = deploy_yml.replace("REPO_NAME", repo_name)
deploy_yml_b64 = b64encode(deploy_yml.encode("utf-8")).decode("utf-8")
data = {
"message": "create deploy.yml",
"committer": {"name": username, "email": email},
"content": deploy_yml_b64,
}
req = requests.put(
f"https://api.github.com/repos/{username}/{repo_name}/contents/.github/workflows/deploy.yml",
headers=headers,
data=json.dumps(data),
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions