Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chrisjsimpson opened this issue Jul 19, 2022 · 0 comments

Comments

@chrisjsimpson
Copy link
Contributor

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),
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant