Used env vars as input instead and removed debug line

This commit is contained in:
Mo Langning 2024-04-08 08:42:25 +00:00
parent a1a38ed648
commit 607736efd4
2 changed files with 15 additions and 4 deletions

View File

@ -12,7 +12,6 @@
import os,subprocess,sys
args=sys.argv[1]
files=[]
STEP_SUMMARY_LOCATION="summary.md"
IS_RUNNING_AS_ACTIONS=False
@ -73,6 +72,18 @@ ERROR_MSG="Errors in file %s on lines %s"
WARNING_STRING="::warning file=%s,line=%s,col=%s,endColumn=%s::%s"
ERROR_STRING="::error file=%s,line=%s,col=%s,endColumn=%s::%s"
if "CHANGED_FILES" not in os.environ:
print("[!] CHANGED_FILES environment variable not found!")
print("[-] This error may occur if you are running this script in your own machine\n")
if len(sys.argv) < 2:
print("[!] No arguments set, exiting.")
exit(2)
args=sys.argv[1]
else:
args=os.environ["CHANGED_FILES"]
if "GITHUB_STEP_SUMMARY" not in os.environ:
print("[!] GITHUB_STEP_SUMMARY not found in system environments!")
print("[-] This error may occur if you are running this script in your own machine\n")
@ -300,8 +311,6 @@ else:
warn_msg=WARN_MSG%(file,', '.join(current_warnings))
check_results[checker_name]["warn"].append(warn_msg)
print(check_results)
for checker,results in check_results.items():
if len(results["error"])>0:

View File

@ -28,4 +28,6 @@ jobs:
uses: tj-actions/changed-files@v34
- name: Analyze all added or modified files
run: |
./.bin/validators.py "${{ steps.changed-files.outputs.all_changed_files }}"
./.bin/validators.py
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}