mirror of
https://github.com/konpa/devicon.git
synced 2025-08-12 01:24:42 +02:00
Updated file names in check_svgs_on_pr
This commit is contained in:
8
.github/scripts/build_assets/arg_getters.py
vendored
8
.github/scripts/build_assets/arg_getters.py
vendored
@@ -45,8 +45,12 @@ def get_check_svgs_on_pr_args():
|
|||||||
Get the commandline arguments for the check_svgs_on_pr.py.
|
Get the commandline arguments for the check_svgs_on_pr.py.
|
||||||
"""
|
"""
|
||||||
parser = ArgumentParser(description="Check the SVGs to ensure their attributes are correct. Run whenever a PR is opened")
|
parser = ArgumentParser(description="Check the SVGs to ensure their attributes are correct. Run whenever a PR is opened")
|
||||||
parser.add_argument("files_changed_json_path",
|
parser.add_argument("files_added_json_path",
|
||||||
help="The path to the files.json created by the gh-action-get-changed-files@2.1.4",
|
help="The path to the files_added.json created by the gh-action-get-changed-files@2.1.4",
|
||||||
|
action=PathResolverAction)
|
||||||
|
|
||||||
|
parser.add_argument("files_modified_json_path",
|
||||||
|
help="The path to the files_modified.json created by the gh-action-get-changed-files@2.1.4",
|
||||||
action=PathResolverAction)
|
action=PathResolverAction)
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
27
.github/scripts/build_assets/filehandler.py
vendored
27
.github/scripts/build_assets/filehandler.py
vendored
@@ -207,23 +207,26 @@ def create_screenshot_folder(dir, screenshot_name: str="screenshots/"):
|
|||||||
finally:
|
finally:
|
||||||
return str(screenshot_folder)
|
return str(screenshot_folder)
|
||||||
|
|
||||||
def get_added_modified_svgs(files_changed_json_path: str):
|
def get_added_modified_svgs(files_added_json_path: str,
|
||||||
|
files_modified_json_path: str):
|
||||||
"""
|
"""
|
||||||
Get the svgs added and modified from the files_changed_json_path.
|
Get the svgs added and modified from the files_changed_json_path.
|
||||||
:param: the path to the files.json created by the gh-action-get-changed-files@2.1.4
|
:param: files_added_json_path, the path to the files_added.json created by the gh-action-get-changed-files@2.1.4
|
||||||
:return: a list of the svg file paths that were added/modified in this pr.
|
:param: files_modified_json_path, the path to the files_modified.json created by the gh-action-get-changed-files@2.1.4
|
||||||
|
:return: a list of the svg file paths that were added/modified in this pr as Path.
|
||||||
"""
|
"""
|
||||||
files_dict = get_json_file_content(files_changed_json_path)
|
files_added = get_json_file_content(files_added_json_path)
|
||||||
print(files_dict)
|
files_modified = get_json_file_content(files_modified_json_path)
|
||||||
svgs = []
|
|
||||||
for file in files_dict["added"]:
|
|
||||||
path = Path(file)
|
|
||||||
if path.suffix.lower() == ".svg":
|
|
||||||
svgs.append(file)
|
|
||||||
|
|
||||||
for file in files_dict["modified"]:
|
svgs = []
|
||||||
|
for file in files_added:
|
||||||
path = Path(file)
|
path = Path(file)
|
||||||
if path.suffix.lower() == ".svg":
|
if path.suffix.lower() == ".svg":
|
||||||
svgs.append(file)
|
svgs.append(path)
|
||||||
|
|
||||||
|
for file in files_modified:
|
||||||
|
path = Path(file)
|
||||||
|
if path.suffix.lower() == ".svg":
|
||||||
|
svgs.append(path)
|
||||||
|
|
||||||
return svgs
|
return svgs
|
||||||
|
2
.github/scripts/build_assets/util.py
vendored
2
.github/scripts/build_assets/util.py
vendored
@@ -13,7 +13,7 @@ def exit_with_err(err: Exception):
|
|||||||
:param: err, the error/exception encountered.
|
:param: err, the error/exception encountered.
|
||||||
"""
|
"""
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
sys.exit(str(err))
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def check_svgs(svg_file_paths: List[Path]):
|
def check_svgs(svg_file_paths: List[Path]):
|
||||||
|
1
.github/scripts/check_svgs_monthly.py
vendored
1
.github/scripts/check_svgs_monthly.py
vendored
@@ -22,6 +22,5 @@ def main():
|
|||||||
util.exit_with_err(e)
|
util.exit_with_err(e)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
4
.github/scripts/check_svgs_on_pr.py
vendored
4
.github/scripts/check_svgs_on_pr.py
vendored
@@ -17,8 +17,10 @@ def main():
|
|||||||
args = arg_getters.get_check_svgs_on_pr_args()
|
args = arg_getters.get_check_svgs_on_pr_args()
|
||||||
try:
|
try:
|
||||||
# check the svgs
|
# check the svgs
|
||||||
svgs = filehandler.get_added_modified_svgs(args.files_changed_json_path)
|
svgs = filehandler.get_added_modified_svgs(args.files_added_json_path,
|
||||||
|
args.files_modified_json_path)
|
||||||
print("SVGs to check: ", *svgs, sep='\n')
|
print("SVGs to check: ", *svgs, sep='\n')
|
||||||
|
|
||||||
util.check_svgs(svgs)
|
util.check_svgs(svgs)
|
||||||
print("All SVGs found were good. Task completed.")
|
print("All SVGs found were good. Task completed.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
2
.github/workflows/check_svgs_on_pr.yml
vendored
2
.github/workflows/check_svgs_on_pr.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- name: Run the check_svg script
|
- name: Run the check_svg script
|
||||||
shell: bash
|
shell: bash
|
||||||
run: >
|
run: >
|
||||||
python ./.github/scripts/check_svgs_on_pr.py $HOME/files.json
|
python ./.github/scripts/check_svgs_on_pr.py $HOME/files_added.json $HOME/files_modified.json
|
||||||
- name: Comment on the PR about the result - Success
|
- name: Comment on the PR about the result - Success
|
||||||
if: success()
|
if: success()
|
||||||
uses: github-actions-up-and-running/pr-comment@v1.0.1
|
uses: github-actions-up-and-running/pr-comment@v1.0.1
|
||||||
|
Reference in New Issue
Block a user