Skip to content

Commit 533acfb

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

File tree

1 file changed

+41
-11
lines changed

1 file changed

+41
-11
lines changed

.github/workflows/module-monitor.yml

Lines changed: 41 additions & 11 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
@@ -85,9 +86,11 @@ jobs:
8586
return "N/A"
8687
8788
try:
89+
print("DEBUG: Loading old_module.yml...", file=sys.stderr)
8890
# Load old and new module.yml
8991
with open('old_module.yml', 'r') as f:
9092
old_data = yaml.safe_load(f)
93+
print("DEBUG: Loading new_module.yml...", file=sys.stderr)
9194
with open('new_module.yml', 'r') as f:
9295
new_data = yaml.safe_load(f)
9396
@@ -144,9 +147,12 @@ jobs:
144147
diff_content.extend(table_rows[2:]) # Skip header rows
145148
146149
# Write to file for GitHub Actions output
150+
print(f"DEBUG: Writing {len(diff_content)} lines to diff_output.txt", file=sys.stderr)
147151
with open('diff_output.txt', 'w') as f:
148152
f.write('\n'.join(diff_content))
149153
154+
print(f"DEBUG: Successfully wrote diff_output.txt", file=sys.stderr)
155+
150156
print("diff_output<<EOF", file=sys.stdout)
151157
print('\n'.join(diff_content), file=sys.stdout)
152158
print("EOF", file=sys.stdout)
@@ -164,9 +170,12 @@ jobs:
164170
blob_content = ["## Current Firmware Blobs:"] + blob_info
165171
166172
# Write to file for GitHub Actions output
173+
print(f"DEBUG: Writing {len(blob_content)} lines to blob_summary.txt", file=sys.stderr)
167174
with open('blob_summary.txt', 'w') as f:
168175
f.write('\n'.join(blob_content))
169176
177+
print(f"DEBUG: Successfully wrote blob_summary.txt", file=sys.stderr)
178+
170179
print("blob_summary<<EOF", file=sys.stdout)
171180
print('\n'.join(blob_content), file=sys.stdout)
172181
print("EOF", file=sys.stdout)
@@ -178,17 +187,38 @@ jobs:
178187
print("blob_summary<<EOF", file=sys.stdout)
179188
print(f"Error parsing module.yml: {e}", file=sys.stdout)
180189
print("EOF", file=sys.stdout)
190+
print("DEBUG: Python script completed successfully", file=sys.stderr)
181191
EOF
182192
183193
- name: Set output variables
194+
id: set-output
184195
run: |
185-
echo "diff_output<<EOF" >> $GITHUB_OUTPUT
186-
cat diff_output.txt >> $GITHUB_OUTPUT
187-
echo "EOF" >> $GITHUB_OUTPUT
196+
echo "DEBUG: Checking if files exist..." >&2
197+
ls -la *.txt >&2 || echo "No .txt files found" >&2
198+
199+
if [ -f diff_output.txt ]; then
200+
echo "DEBUG: diff_output.txt exists, size: $(wc -c < diff_output.txt)" >&2
201+
echo "diff_output<<EOF" >> $GITHUB_OUTPUT
202+
cat diff_output.txt >> $GITHUB_OUTPUT
203+
echo "EOF" >> $GITHUB_OUTPUT
204+
else
205+
echo "DEBUG: diff_output.txt not found" >&2
206+
echo "diff_output<<EOF" >> $GITHUB_OUTPUT
207+
echo "No changes detected" >> $GITHUB_OUTPUT
208+
echo "EOF" >> $GITHUB_OUTPUT
209+
fi
188210
189-
echo "blob_summary<<EOF" >> $GITHUB_OUTPUT
190-
cat blob_summary.txt >> $GITHUB_OUTPUT
191-
echo "EOF" >> $GITHUB_OUTPUT
211+
if [ -f blob_summary.txt ]; then
212+
echo "DEBUG: blob_summary.txt exists, size: $(wc -c < blob_summary.txt)" >&2
213+
echo "blob_summary<<EOF" >> $GITHUB_OUTPUT
214+
cat blob_summary.txt >> $GITHUB_OUTPUT
215+
echo "EOF" >> $GITHUB_OUTPUT
216+
else
217+
echo "DEBUG: blob_summary.txt not found" >&2
218+
echo "blob_summary<<EOF" >> $GITHUB_OUTPUT
219+
echo "No blob summary available" >> $GITHUB_OUTPUT
220+
echo "EOF" >> $GITHUB_OUTPUT
221+
fi
192222
193223
- name: Create or update comment
194224
uses: actions/github-script@v7
@@ -228,8 +258,8 @@ jobs:
228258
});
229259
}
230260
env:
231-
diff_output: ${{ steps.changes.outputs.diff_output }}
232-
blob_summary: ${{ steps.changes.outputs.blob_summary }}
261+
diff_output: ${{ steps.set-output.outputs.diff_output }}
262+
blob_summary: ${{ steps.set-output.outputs.blob_summary }}
233263

234264

235265

@@ -239,7 +269,7 @@ jobs:
239269
echo "" >> $GITHUB_STEP_SUMMARY
240270
echo "### Changes in zephyr/module.yml:" >> $GITHUB_STEP_SUMMARY
241271
echo '```diff' >> $GITHUB_STEP_SUMMARY
242-
echo "${{ steps.changes.outputs.diff_output }}" >> $GITHUB_STEP_SUMMARY
272+
echo "${{ steps.set-output.outputs.diff_output }}" >> $GITHUB_STEP_SUMMARY
243273
echo '```' >> $GITHUB_STEP_SUMMARY
244274
echo "" >> $GITHUB_STEP_SUMMARY
245-
echo "${{ steps.changes.outputs.blob_summary }}" >> $GITHUB_STEP_SUMMARY
275+
echo "${{ steps.set-output.outputs.blob_summary }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)