Update coupling capacitors #1
|
@ -1,5 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
'''
|
||||||
|
Iterates a bom in csv format and validates all attributes meet some conditions,
|
||||||
|
logging warnings & exporting a report.md file.
|
||||||
|
'''
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from allspice import AllSpice, DesignReview
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
parser = argparse.ArgumentParser(
|
|
||||||
prog="review_comment", description="Comment on a design review with markdown content."
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"repository", help="The repo containing the project in the form 'owner/repo'"
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"review_number", help="The design review number'"
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"source_file",
|
|
||||||
help=(
|
|
||||||
"The path to the source file containing the content to post in the comment body."
|
|
||||||
),
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"--allspice_hub_url",
|
|
||||||
help="The URL of your AllSpice Hub instance. Defaults to https://hub.allspice.io.",
|
|
||||||
)
|
|
||||||
|
|
||||||
auth_token = os.environ.get("ALLSPICE_AUTH_TOKEN")
|
|
||||||
if auth_token is None:
|
|
||||||
print("Please set the environment variable ALLSPICE_AUTH_TOKEN")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
auth_token = os.environ.get("ALLSPICE_AUTH_TOKEN")
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
pr_number = args.review_number
|
|
||||||
repo_owner, repo_name = args.repository.split("/")
|
|
||||||
comment_file = args.source_file
|
|
||||||
|
|
||||||
if args.allspice_hub_url is None:
|
|
||||||
allspice = AllSpice(token_text=auth_token)
|
|
||||||
else:
|
|
||||||
allspice = AllSpice(token_text=auth_token, allspice_hub_url=args.allspice_hub_url)
|
|
||||||
|
|
||||||
design_review = DesignReview.request(allspice, repo_owner, repo_name, pr_number)
|
|
||||||
|
|
||||||
with open(comment_file, "r") as f:
|
|
||||||
design_review.create_comment(f.read())
|
|
|
@ -44,13 +44,16 @@ jobs:
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
|
|
||||||
# Note: if we add any other dependencies we should include a requirements.txt file
|
# Note: if we add any other dependencies we should include a requirements.txt file
|
||||||
- run: pip install jinja2 py-allspice
|
- name: Install Python Dependencies
|
||||||
|
run: pip install jinja2 py-allspice
|
||||||
|
|
||||||
- name: Check Components
|
- name: Check Components
|
||||||
run: .allspice/component_validation.py ./bom.csv
|
run: .allspice/component_validation.py ./bom.csv
|
||||||
|
|
||||||
- name: Comment Results
|
- name: Post Comment on Design Review
|
||||||
run: .allspice/review_comment.py --allspice_hub_url ${{ github.server_url }} ${{ github.repository }} ${{ github.event.number }} ./.allspice/report.md
|
uses: https://hub.allspice.io/Actions/post-dr-comment@v0.1
|
||||||
env:
|
with:
|
||||||
ALLSPICE_AUTH_TOKEN: ${{ github.token }}
|
# The path to the markdown file containing the comment body.
|
||||||
|
comment_path: .allspice/report.md
|
||||||
|
|
Note: AllSpice cannot diff pdf files. Rendering head (latest) version below.
Loading…
Reference in New Issue