6
mirror of https://github.com/AllSpiceIO/generate-bom.git synced 2025-03-13 22:44:33 +00:00

Support passing log level from the action

This commit is contained in:
Shrikanth Upadhayaya 2024-10-16 11:28:44 -04:00
parent 4f099257f6
commit c911adb9a0
No known key found for this signature in database
2 changed files with 19 additions and 2 deletions

View File

@ -33,6 +33,12 @@ inputs:
BOM will be generated for the default variant. Not supported for OrCAD
projects.
default: ""
log_level:
description: >
The level at which to log. Use "DEBUG" to get more information, such as
about which file was used to match which device sheet.
required: false
default: INFO
auth_token:
description: >
The AllSpice Hub Auth token to use. If not provided, the autogenerated
@ -55,6 +61,8 @@ runs:
- ${{ inputs.variant }}
- "--output_file"
- "${{ github.workspace}}/${{ inputs.output_file_name }}"
- "--log-level"
- ${{ inputs.log_level }}
- ${{ github.repository }}
- ${{ inputs.source_path }}
env:

View File

@ -68,6 +68,11 @@ if __name__ == "__main__":
"generated for the default variant. This is not used for OrCAD projects."
),
)
parser.add_argument(
"--log-level",
help="The log level for the logger. Defaults to INFO.",
default="INFO",
)
args = parser.parse_args()
@ -113,9 +118,13 @@ if __name__ == "__main__":
exit(1)
if args.allspice_hub_url is None:
allspice = AllSpice(token_text=auth_token)
allspice = AllSpice(token_text=auth_token, log_level=args.log_level)
else:
allspice = AllSpice(token_text=auth_token, allspice_hub_url=args.allspice_hub_url)
allspice = AllSpice(
token_text=auth_token,
allspice_hub_url=args.allspice_hub_url,
log_level=args.log_level,
)
repo_owner, repo_name = args.repository.split("/")
repository = allspice.get_repository(repo_owner, repo_name)