浏览代码

pre-commit - fix depencency on pydoc-markdown (#5390)

/colab-links
GitHub 4 年前
当前提交
0e95a4b2
共有 3 个文件被更改,包括 6 次插入12 次删除
  1. 4
      .github/workflows/pre-commit.yml
  2. 5
      .pre-commit-config.yaml
  3. 9
      utils/generate_markdown_docs.py

4
.github/workflows/pre-commit.yml


- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pydoc-markdown==3.10.1
- uses: pre-commit/action@v2.0.0
markdown-link-check:

5
.pre-commit-config.yaml


entry: utils/validate_release_links.py
- id: generate-markdown-docs
name: generate markdown docs
language: script
entry: utils/generate_markdown_docs.py --package_dirs ml-agents-envs
language: python
entry: ./utils/generate_markdown_docs.py --package_dirs ml-agents-envs
additional_dependencies: [pyyaml, pydoc-markdown==3.10.1]

9
utils/generate_markdown_docs.py


parser.add_argument("--package_dirs", nargs="+")
args = parser.parse_args()
ok = False
return_code = 0
ok = True
for package_dir in args.package_dirs:
config_path = os.path.join(os.getcwd(), package_dir, "pydoc-config.yaml")
print(config_path)

subprocess.check_call(subprocess_args, stdout=output_file)
remove_trailing_whitespace(output_file_name)
new_hash = hash_file(output_file_name)
ok = old_hash == new_hash
return_code = 0 if ok else 1
ok &= old_hash == new_hash
sys.exit(return_code)
sys.exit(0 if ok else 1)
正在加载...
取消
保存