Skip to content

Commit a3b6167

Browse files
author
Chris Elion
authored
pre-commit - fix depencency on pydoc-markdown (#5390)
1 parent 4390c85 commit a3b6167

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

.github/workflows/pre-commit.yml

-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ jobs:
1919
- uses: actions/setup-dotnet@v1
2020
with:
2121
dotnet-version: '3.1.x'
22-
- name: Install dependencies
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install pydoc-markdown==3.10.1
2622
- uses: pre-commit/[email protected]
2723

2824
markdown-link-check:

.pre-commit-config.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ repos:
127127
entry: utils/validate_release_links.py
128128
- id: generate-markdown-docs
129129
name: generate markdown docs
130-
language: script
131-
entry: utils/generate_markdown_docs.py --package_dirs ml-agents-envs
130+
language: python
131+
entry: ./utils/generate_markdown_docs.py --package_dirs ml-agents-envs
132132
pass_filenames: false
133+
additional_dependencies: [pyyaml, pydoc-markdown==3.10.1]

utils/generate_markdown_docs.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ def remove_trailing_whitespace(filename):
6969
parser.add_argument("--package_dirs", nargs="+")
7070
args = parser.parse_args()
7171

72-
ok = False
73-
return_code = 0
72+
ok = True
7473
for package_dir in args.package_dirs:
7574
config_path = os.path.join(os.getcwd(), package_dir, "pydoc-config.yaml")
7675
print(config_path)
@@ -96,8 +95,6 @@ def remove_trailing_whitespace(filename):
9695
subprocess.check_call(subprocess_args, stdout=output_file)
9796
remove_trailing_whitespace(output_file_name)
9897
new_hash = hash_file(output_file_name)
99-
ok = old_hash == new_hash
98+
ok &= old_hash == new_hash
10099

101-
return_code = 0 if ok else 1
102-
103-
sys.exit(return_code)
100+
sys.exit(0 if ok else 1)

0 commit comments

Comments
 (0)