Skip to content

Commit fa5cc9e

Browse files
authored
Require new ontologies include a link to contribution guidelines (#1841)
* Add contributing link to new ontology form This is one of the follow-up items to #1836, so review of this PR should wait until there's a decision on that one * Add automated test for contribution guidelines on new ontologies * Update test_integrity.py * Update test_integrity.py
1 parent 01d0a97 commit fa5cc9e

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

.github/ISSUE_TEMPLATE/new-ontology.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ body:
102102
placeholder: e.g. https://github.com/obophenotype/uberon/issues
103103
validations:
104104
required: true
105+
- type: input
106+
id: contributing
107+
attributes:
108+
label: Contribution Guidelines
109+
description: What is the URL of contribution guidelines? Ideally, this is a file name CONTRIBUTING or CONTRIBUTING.md in the root of your repository.
110+
placeholder: e.g. https://github.com/geneontology/go-ontology/blob/master/CONTRIBUTING.md
111+
validations:
112+
required: true
105113
- type: input
106114
id: download
107115
attributes:

tests/test_integrity.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,3 +334,29 @@ def test_repository_license(self):
334334
OBO_TO_SPDX[obo_license],
335335
msg="OBO Foundry license annotation does not match GitHub license",
336336
)
337+
338+
def test_contribution_guidelines(self):
339+
"""Test that a contribution guidelines document is available in an expected location/format."""
340+
for prefix, data in self.ontologies.items():
341+
repository = data["repository"]
342+
if not repository.startswith("https://github.com"):
343+
continue
344+
r = repository.removeprefix("https://github.com/").rstrip("/")
345+
github_data = self._get_github_data(prefix)
346+
default_branch = github_data["default_branch"]
347+
paths = [
348+
# Markdown
349+
f"https://github.com/{r}/blob/{default_branch}/CONTRIBUTING.md",
350+
f"https://github.com/{r}/blob/{default_branch}/docs/CONTRIBUTING.md",
351+
f"https://github.com/{r}/blob/{default_branch}/.github/CONTRIBUTING.md",
352+
# RST
353+
f"https://github.com/{r}/blob/{default_branch}/CONTRIBUTING.rst",
354+
f"https://github.com/{r}/blob/{default_branch}/docs/CONTRIBUTING.rst",
355+
f"https://github.com/{r}/blob/{default_branch}/.github/CONTRIBUTING.rst",
356+
]
357+
self.assertTrue(
358+
any(requests.get(path).status_code == 200 for path in paths),
359+
msg=f"Could not find a CONTRIBUTING.md file in the repository for {prefix} ({repository}) in any of "
360+
"the standard locations defined by GitHub in https://docs.github.com/en/communities/setting-up-"
361+
"your-project-for-healthy-contributions/setting-guidelines-for-repository-contributors.",
362+
)

0 commit comments

Comments
 (0)