Skip to content

Commit b76a7a4

Browse files
committed
Debug
Signed-off-by: Chaitanya Tata <[email protected]>
1 parent 6242ef3 commit b76a7a4

File tree

1 file changed

+48
-13
lines changed

1 file changed

+48
-13
lines changed

.github/workflows/module-monitor.yml

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Module Monitor
22
on:
3-
pull_request_target:
3+
pull_request:
44
paths:
55
- 'zephyr/module.yml'
66

@@ -54,6 +54,7 @@ jobs:
5454
git show $HEAD_REF:zephyr/module.yml > new_module.yml
5555
5656
# Parse YAML and generate comparison table
57+
echo "DEBUG: Starting Python script..." >&2
5758
python3 << 'EOF'
5859
import yaml
5960
import sys
@@ -78,16 +79,23 @@ jobs:
7879
old_commit = extract_commit_from_url(old_url)
7980
new_commit = extract_commit_from_url(new_url)
8081
82+
# Extract the path from the URL to make the diff more specific
83+
path_part = ""
84+
if '/nrf_wifi/bin/' in new_url:
85+
path_part = "#diff-diff-nrf_wifi"
86+
8187
if old_commit != "Unknown" and new_commit != "Unknown" and old_commit != new_commit:
82-
return f"https://github.com/nrfconnect/sdk-nrfxlib/compare/{old_commit}...{new_commit}"
88+
return f"https://github.com/nrfconnect/sdk-nrfxlib/compare/{old_commit}...{new_commit}{path_part}"
8389
elif new_commit != "Unknown":
84-
return f"https://github.com/nrfconnect/sdk-nrfxlib/commit/{new_commit}"
90+
return f"https://github.com/nrfconnect/sdk-nrfxlib/commit/{new_commit}{path_part}"
8591
return "N/A"
8692
8793
try:
94+
print("DEBUG: Loading old_module.yml...", file=sys.stderr)
8895
# Load old and new module.yml
8996
with open('old_module.yml', 'r') as f:
9097
old_data = yaml.safe_load(f)
98+
print("DEBUG: Loading new_module.yml...", file=sys.stderr)
9199
with open('new_module.yml', 'r') as f:
92100
new_data = yaml.safe_load(f)
93101
@@ -144,9 +152,12 @@ jobs:
144152
diff_content.extend(table_rows[2:]) # Skip header rows
145153
146154
# Write to file for GitHub Actions output
155+
print(f"DEBUG: Writing {len(diff_content)} lines to diff_output.txt", file=sys.stderr)
147156
with open('diff_output.txt', 'w') as f:
148157
f.write('\n'.join(diff_content))
149158
159+
print(f"DEBUG: Successfully wrote diff_output.txt", file=sys.stderr)
160+
150161
print("diff_output<<EOF", file=sys.stdout)
151162
print('\n'.join(diff_content), file=sys.stdout)
152163
print("EOF", file=sys.stdout)
@@ -164,9 +175,12 @@ jobs:
164175
blob_content = ["## Current Firmware Blobs:"] + blob_info
165176
166177
# Write to file for GitHub Actions output
178+
print(f"DEBUG: Writing {len(blob_content)} lines to blob_summary.txt", file=sys.stderr)
167179
with open('blob_summary.txt', 'w') as f:
168180
f.write('\n'.join(blob_content))
169181
182+
print(f"DEBUG: Successfully wrote blob_summary.txt", file=sys.stderr)
183+
170184
print("blob_summary<<EOF", file=sys.stdout)
171185
print('\n'.join(blob_content), file=sys.stdout)
172186
print("EOF", file=sys.stdout)
@@ -178,17 +192,38 @@ jobs:
178192
print("blob_summary<<EOF", file=sys.stdout)
179193
print(f"Error parsing module.yml: {e}", file=sys.stdout)
180194
print("EOF", file=sys.stdout)
195+
print("DEBUG: Python script completed successfully", file=sys.stderr)
181196
EOF
182197
183198
- name: Set output variables
199+
id: set-output
184200
run: |
185-
echo "diff_output<<EOF" >> $GITHUB_OUTPUT
186-
cat diff_output.txt >> $GITHUB_OUTPUT
187-
echo "EOF" >> $GITHUB_OUTPUT
201+
echo "DEBUG: Checking if files exist..." >&2
202+
ls -la *.txt >&2 || echo "No .txt files found" >&2
203+
204+
if [ -f diff_output.txt ]; then
205+
echo "DEBUG: diff_output.txt exists, size: $(wc -c < diff_output.txt)" >&2
206+
echo "diff_output<<EOF" >> $GITHUB_OUTPUT
207+
cat diff_output.txt >> $GITHUB_OUTPUT
208+
echo "EOF" >> $GITHUB_OUTPUT
209+
else
210+
echo "DEBUG: diff_output.txt not found" >&2
211+
echo "diff_output<<EOF" >> $GITHUB_OUTPUT
212+
echo "No changes detected" >> $GITHUB_OUTPUT
213+
echo "EOF" >> $GITHUB_OUTPUT
214+
fi
188215
189-
echo "blob_summary<<EOF" >> $GITHUB_OUTPUT
190-
cat blob_summary.txt >> $GITHUB_OUTPUT
191-
echo "EOF" >> $GITHUB_OUTPUT
216+
if [ -f blob_summary.txt ]; then
217+
echo "DEBUG: blob_summary.txt exists, size: $(wc -c < blob_summary.txt)" >&2
218+
echo "blob_summary<<EOF" >> $GITHUB_OUTPUT
219+
cat blob_summary.txt >> $GITHUB_OUTPUT
220+
echo "EOF" >> $GITHUB_OUTPUT
221+
else
222+
echo "DEBUG: blob_summary.txt not found" >&2
223+
echo "blob_summary<<EOF" >> $GITHUB_OUTPUT
224+
echo "No blob summary available" >> $GITHUB_OUTPUT
225+
echo "EOF" >> $GITHUB_OUTPUT
226+
fi
192227
193228
- name: Create or update comment
194229
uses: actions/github-script@v7
@@ -228,8 +263,8 @@ jobs:
228263
});
229264
}
230265
env:
231-
diff_output: ${{ steps.changes.outputs.diff_output }}
232-
blob_summary: ${{ steps.changes.outputs.blob_summary }}
266+
diff_output: ${{ steps.set-output.outputs.diff_output }}
267+
blob_summary: ${{ steps.set-output.outputs.blob_summary }}
233268

234269

235270

@@ -239,7 +274,7 @@ jobs:
239274
echo "" >> $GITHUB_STEP_SUMMARY
240275
echo "### Changes in zephyr/module.yml:" >> $GITHUB_STEP_SUMMARY
241276
echo '```diff' >> $GITHUB_STEP_SUMMARY
242-
echo "${{ steps.changes.outputs.diff_output }}" >> $GITHUB_STEP_SUMMARY
277+
echo "${{ steps.set-output.outputs.diff_output }}" >> $GITHUB_STEP_SUMMARY
243278
echo '```' >> $GITHUB_STEP_SUMMARY
244279
echo "" >> $GITHUB_STEP_SUMMARY
245-
echo "${{ steps.changes.outputs.blob_summary }}" >> $GITHUB_STEP_SUMMARY
280+
echo "${{ steps.set-output.outputs.blob_summary }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)