Fix readme validation failures (#3003)
* Add readme template to contributing.md * Update exclusion list * Add more paths to exclusion file * Add debugging statements * Wrap in try/except * Wrap in try/except * Run black to format * Add sample to exclusions list
This commit is contained in:
Родитель
642713a1d8
Коммит
d43ed2adc3
|
@ -73,7 +73,7 @@ This will also generate a GitHub Actions workflow file for any new examples in t
|
|||
|
||||
Examples in this repository can be indexed in the [Microsoft code samples browser](https://docs.microsoft.com/samples), enabling organic discoverability. To accomplish this:
|
||||
|
||||
- add an excellent `README.md` file in the example directory noting the overview, objective, and estimated runtime. (Note than estimated runtimes should not exceed 30 minutes).
|
||||
- add an excellent `README.md` file in the example directory noting the overview, objective, and estimated runtime. (Note than estimated runtimes should not exceed 30 minutes). Follow the README template [here](https://github.com/Azure/azureml-examples/blob/main/infra/templates/readme_template.md)
|
||||
- add required YAML frontmatter at the top of the `README.md`
|
||||
|
||||
The YAML frontmatter format looks like this:
|
||||
|
|
|
@ -15,7 +15,7 @@ repo_root = Path(__file__).resolve().parent.parent
|
|||
|
||||
|
||||
def main():
|
||||
INVALID_README_MSG = f"{sample_path} does not contain a README.md file with all required words. See the Discoverability section of CONTRIBUTING.md."
|
||||
INVALID_README_MSG = f"{sample_path} does not contain a README.md file with all required words. See the Discoverability section of CONTRIBUTING.md to create a valid README or add the file path to ./infra/bootstrapping/readme_validation_exclusions.txt."
|
||||
EXCLUSIONS_FILE_PATH = f"{repo_root}/bootstrapping/readme_validation_exclusions.txt"
|
||||
required_sections = [
|
||||
"overview",
|
||||
|
@ -33,16 +33,20 @@ def main():
|
|||
)
|
||||
|
||||
# Check if sample is excluded from README validation
|
||||
with open(EXCLUSIONS_FILE_PATH, encoding="utf-8") as exclusions_file:
|
||||
exclusions = exclusions_file.read().splitlines()
|
||||
if sample_path in exclusions:
|
||||
print(
|
||||
f"Skipping {sample_path} since it is excluded from README validation."
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
# Check if sample contains a valid README.md file
|
||||
try:
|
||||
with open(EXCLUSIONS_FILE_PATH, encoding="utf-8") as exclusions_file:
|
||||
exclusions = exclusions_file.read().splitlines()
|
||||
|
||||
for exclusion in exclusions:
|
||||
print(exclusion + "\n")
|
||||
|
||||
if sample_path in exclusions:
|
||||
print(
|
||||
f"Skipping {sample_path} since it is excluded from README validation."
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
# Check if sample contains a valid README.md file
|
||||
with open(f"{sample_path}/README.md", encoding="utf-8") as readme_file:
|
||||
readme_content = readme_file.read()
|
||||
if all(section in readme_content for section in required_sections):
|
||||
|
@ -50,8 +54,8 @@ def main():
|
|||
f"{sample_path} contains a README.md file with all required sections."
|
||||
)
|
||||
sys.exit(0)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
except FileNotFoundError as e:
|
||||
print(f"hit error {e}")
|
||||
|
||||
print(INVALID_README_MSG)
|
||||
sys.exit(1)
|
||||
|
|
|
@ -206,4 +206,22 @@
|
|||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/resources/compute
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/resources/connections
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/resources/datastores
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/resources/registry
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/resources/registry
|
||||
/home/runner/work/azureml-examples/azureml-examples/tutorials/azureml-getting-started
|
||||
/home/runner/work/azureml-examples/azureml-examples/tutorials/azureml-in-a-day
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/jobs/spark/automation
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/jobs/spark
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/responsible-ai/mlflow-deployment-with-explanations
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/responsible-ai/tabular/responsibleaidashboard-diabetes-decision-making
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/responsible-ai/tabular/responsibleaidashboard-diabetes-regression-model-debugging
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/responsible-ai/tabular/responsibleaidashboard-housing-classification-model-debugging
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/responsible-ai/tabular/responsibleaidashboard-housing-decision-making
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/responsible-ai/tabular/responsibleaidashboard-programmer-regression-model-debugging
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/using-mltable/delimited-files-example
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/using-mltable/delta-lake-example
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/using-mltable/from-paths-example
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/using-mltable/local-to-cloud
|
||||
/home/runner/work/azureml-examples/azureml-examples/sdk/python/using-mltable/quickstart
|
||||
/home/runner/work/azureml-examples/azureml-examples/tutorials/e2e-distributed-pytorch-image
|
||||
/home/runner/work/azureml-examples/azureml-examples/tutorials/e2e-ds-experience
|
||||
/home/runner/work/azureml-examples/azureml-examples/tutorials/get-started-notebooks
|
Загрузка…
Ссылка в новой задаче