Skip to content

Commit

Permalink
fix: check pyproject.toml file exists before opening it (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
klmcadams authored May 6, 2024
1 parent 56313a9 commit ae38d78
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
needs: commit-and-branch-style
steps:
- name: "Run documentation style checks"
uses: ansys/actions/doc-style@main
uses: ansys/actions/doc-style@fix/file-dne
with:
token: ${{ secrets.GITHUB_TOKEN }}

Expand Down
21 changes: 12 additions & 9 deletions doc-style/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,18 @@ runs:
import os
import toml
# Load pyproject.toml
with open('pyproject.toml', 'r') as f:
config = toml.load(f)
try:
# Get towncrier directory
directory=config["tool"]["towncrier"]["directory"]
except KeyError:
# If towncrier directory isn't specified in pyproject.toml
directory=""
if os.path.exists("pyproject.toml"):
# Load pyproject.toml
with open('pyproject.toml', 'r') as f:
config = toml.load(f)
try:
# Get towncrier directory
directory=config["tool"]["towncrier"]["directory"]
except KeyError:
# If towncrier directory isn't specified in pyproject.toml
directory=""
else:
directory=""
# Get the GITHUB_ENV variable
github_env = os.getenv('GITHUB_ENV')
Expand Down

0 comments on commit ae38d78

Please sign in to comment.