Skip to content

Commit

Permalink
Debugging utf-8 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
gvrose8192 committed Jan 13, 2025
1 parent cb3a720 commit 0f2b0a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/process-git-request.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
os.chdir(working_dir)
# print(f"pwd : {os.getcwd()}")
git_cmd = f"git log --oneline --no-abbrev-commit origin/{target_branch}..origin/{source_branch}"
# print(git_cmd)
print(f"git command is {git_cmd}")
loglines_to_check = 13
try:
out, err = subprocess.Popen(git_cmd, shell=True, stdout=subprocess.PIPE,
Expand All @@ -46,7 +46,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
y = x.split()
print(f"This is y {y}")
commit_sha = str(y[0])
print("Found a commit in line ", commit_sha)
print(f"Found a commit in line ", commit_sha)

git_cmd = "git show " + commit_sha
gitlog_out, gitlog_err = subprocess.Popen(git_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).communicate()
Expand All @@ -58,7 +58,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
upstream_diff = False

for logline in loglines:
print(f"Processing logline {commit_sh}")
print(f"Processing logline {commit_sha}")
lines_counted += 1
if lines_counted == 1:
file.write("Merge Request sha: " + local_diffdiff_sha)
Expand All @@ -81,7 +81,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
if "commit" in logline.lower():
commit_sha = re.search(r'[0-9a-f]{40}', logline)
upstream_diffdiff_sha = str(commit_sha.group(0)) if commit_sha else ""
print("Upstream : " + upstream_diffdiff_sha)
print(f"Upstream : " + upstream_diffdiff_sha)
if upstream_diffdiff_sha:
file.write("\tUpstream sha: " + upstream_diffdiff_sha)
file.write("\n")
Expand All @@ -99,10 +99,12 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
diff_status = process.returncode

if diff_status != 0 and not upstream_diff:
print("diffdiff out: " + diff_out)
print("diffdiff err: " + diff_err)
print(f"diffdiff out: " + diff_out)
print(f"diffdiff err: " + diff_err)
retcode = 1
file.write("error:\nCommit: " + local_diffdiff_sha + " differs with no upstream tag in commit message\n")
except:
print(f"Exception in git log command error {err}")

finally:
file.close()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/process-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
if ! git fetch origin ${{ github.head_ref }}; then
echo "Unable to checkout ${{ github.head_ref }}"
fi
git remote add linux https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --shallow-since="3 years ago" linux
# git remote add linux https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
# git fetch --shallow-since="3 years ago" linux
echo "Will run process-git-request.py with:"
echo "fname = ${{ github.run_id }}"
echo "target_branch = ${{ github.base_ref }}"
Expand Down

0 comments on commit 0f2b0a1

Please sign in to comment.