Skip to content

Commit f92b2bd

Browse files
authored
Improve debugging for pr_checks (onnx#7623)
### Motivation and Context Fixes # --------- Signed-off-by: Andreas Fehlner <fehlner@arcor.de>
1 parent e31a583 commit f92b2bd

File tree

2 files changed

+100
-3
lines changed

2 files changed

+100
-3
lines changed

.github/workflows/pr_checks.yml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ jobs:
2323
permissions:
2424
contents: read
2525
steps:
26+
- name: Debug PR info
27+
env:
28+
PR_NUMBER: ${{ github.event.pull_request.number }}
29+
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
30+
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
31+
REPOSITORY: ${{ github.repository }}
32+
RUN_ID: ${{ github.run_id }}
33+
run: |
34+
echo "=== PR Info ==="
35+
echo "PR number: $PR_NUMBER"
36+
echo "PR head SHA: $PR_HEAD_SHA"
37+
echo "PR base ref: $PR_BASE_REF"
38+
echo "Repository: $REPOSITORY"
39+
echo "Run ID: $RUN_ID"
2640
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2741
with:
2842
persist-credentials: false
@@ -36,16 +50,48 @@ jobs:
3650
lintrunner init
3751
- name: Run lintrunner on all files
3852
run: |
53+
echo "=== Running lintrunner ==="
3954
set +e
4055
lintrunner f --all-files -v
56+
LINT_EXIT_CODE=$?
57+
echo "Lintrunner exit code: $LINT_EXIT_CODE"
58+
echo "=== Git status after lintrunner ==="
59+
git status --short
4160
exit 0
4261
- name: Save PR number and diff
62+
env:
63+
PR_NUMBER: ${{ github.event.pull_request.number }}
4364
run: |
65+
echo "=== Creating artifacts ==="
4466
mkdir -p ./pr_artifacts
45-
echo "${{ github.event.pull_request.number }}" > ./pr_artifacts/pr_number
67+
echo "$PR_NUMBER" > ./pr_artifacts/pr_number
68+
echo "PR number saved: $(cat ./pr_artifacts/pr_number)"
69+
70+
echo "=== Generating diff ==="
4671
git diff > ./pr_artifacts/lintrunner.diff
72+
73+
echo "=== Diff stats ==="
74+
echo "Diff file size: $(wc -c < ./pr_artifacts/lintrunner.diff) bytes"
75+
echo "Diff file lines: $(wc -l < ./pr_artifacts/lintrunner.diff) lines"
76+
77+
if [ -s ./pr_artifacts/lintrunner.diff ]; then
78+
echo "Diff has content, showing first 30 lines:"
79+
head -30 ./pr_artifacts/lintrunner.diff
80+
else
81+
echo "Diff is empty (no changes from lintrunner)"
82+
fi
83+
84+
echo "=== Listing pr_artifacts directory ==="
85+
ls -la ./pr_artifacts/
4786
- name: Upload artifacts
4887
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
4988
with:
5089
name: pr-artifacts
5190
path: pr_artifacts/
91+
- name: Debug upload result
92+
env:
93+
RUN_ID: ${{ github.run_id }}
94+
run: |
95+
echo "=== Upload completed ==="
96+
echo "Artifacts should now be available with name: pr-artifacts"
97+
echo "Run ID for download: $RUN_ID"

.github/workflows/pr_checks_comment.yml

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ jobs:
2222
contents: read
2323
pull-requests: write
2424
steps:
25+
- name: Debug workflow run info
26+
env:
27+
WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}
28+
WORKFLOW_CONCLUSION: ${{ github.event.workflow_run.conclusion }}
29+
WORKFLOW_EVENT: ${{ github.event.workflow_run.event }}
30+
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
31+
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
32+
run: |
33+
echo "=== Workflow Run Info ==="
34+
echo "Workflow run ID: $WORKFLOW_RUN_ID"
35+
echo "Workflow run conclusion: $WORKFLOW_CONCLUSION"
36+
echo "Workflow run event: $WORKFLOW_EVENT"
37+
echo "Head branch: $HEAD_BRANCH"
38+
echo "Head SHA: $HEAD_SHA"
2539
- name: Download artifacts
2640
id: download
2741
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
@@ -31,19 +45,48 @@ jobs:
3145
path: pr_artifacts/
3246
run-id: ${{ github.event.workflow_run.id }}
3347
github-token: ${{ secrets.GITHUB_TOKEN }}
48+
- name: Debug download result
49+
env:
50+
DOWNLOAD_OUTCOME: ${{ steps.download.outcome }}
51+
run: |
52+
echo "=== Download Result ==="
53+
echo "Download outcome: $DOWNLOAD_OUTCOME"
54+
echo "Listing pr_artifacts directory:"
55+
ls -la pr_artifacts/ 2>/dev/null || echo "Directory does not exist"
3456
- name: Get PR number
3557
if: steps.download.outcome == 'success'
3658
id: pr
37-
run: echo "number=$(cat pr_artifacts/pr_number)" >> "$GITHUB_OUTPUT"
59+
run: |
60+
echo "=== PR Number ==="
61+
cat pr_artifacts/pr_number
62+
echo "number=$(cat pr_artifacts/pr_number)" >> "$GITHUB_OUTPUT"
3863
- name: Check if diff is empty
3964
if: steps.download.outcome == 'success'
4065
id: diff
4166
run: |
67+
echo "=== Diff Check ==="
68+
echo "Diff file size: $(wc -c < pr_artifacts/lintrunner.diff) bytes"
69+
echo "Diff file lines: $(wc -l < pr_artifacts/lintrunner.diff) lines"
4270
if [ -s pr_artifacts/lintrunner.diff ]; then
4371
echo "has_changes=true" >> "$GITHUB_OUTPUT"
72+
echo "Diff has changes, showing first 50 lines:"
73+
head -50 pr_artifacts/lintrunner.diff
4474
else
4575
echo "has_changes=false" >> "$GITHUB_OUTPUT"
76+
echo "Diff is empty, no changes to apply"
4677
fi
78+
- name: Debug before checkout
79+
if: steps.download.outcome == 'success'
80+
env:
81+
DOWNLOAD_OUTCOME: ${{ steps.download.outcome }}
82+
HAS_CHANGES: ${{ steps.diff.outputs.has_changes }}
83+
PR_NUMBER: ${{ steps.pr.outputs.number }}
84+
run: |
85+
echo "=== Pre-Checkout Debug ==="
86+
echo "Download outcome: $DOWNLOAD_OUTCOME"
87+
echo "Has changes: $HAS_CHANGES"
88+
echo "PR number: $PR_NUMBER"
89+
echo "Will checkout: ${{ steps.download.outcome == 'success' && steps.diff.outputs.has_changes == 'true' }}"
4790
- name: Checkout PR
4891
if: steps.download.outcome == 'success' && steps.diff.outputs.has_changes == 'true'
4992
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -52,7 +95,15 @@ jobs:
5295
persist-credentials: false
5396
- name: Apply lintrunner fixes
5497
if: steps.download.outcome == 'success' && steps.diff.outputs.has_changes == 'true'
55-
run: git apply pr_artifacts/lintrunner.diff
98+
run: |
99+
echo "=== Applying Diff ==="
100+
echo "Current directory: $(pwd)"
101+
echo "Git status before apply:"
102+
git status --short
103+
echo "Applying diff..."
104+
git apply pr_artifacts/lintrunner.diff
105+
echo "Git status after apply:"
106+
git status --short
56107
- name: Suggest changes
57108
if: steps.download.outcome == 'success' && steps.diff.outputs.has_changes == 'true'
58109
uses: parkerbxyz/suggest-changes@bd099ea0d10f0e9efeb9e46d604bbe6d7a80bc34

0 commit comments

Comments
 (0)