Add automatic comment when autofix fails because of regress.yml#1767
Add automatic comment when autofix fails because of regress.yml#1767dhower-qc wants to merge 12 commits intoriscv:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds CI automation to detect when ./bin/chore gen all regenerates .github/workflows/regress.yml during autofix.ci, and posts an explanatory PR comment when the autofix run fails in that situation.
Changes:
- Record and compare a hash of
.github/workflows/regress.ymlbefore/after./bin/chore gen all, and upload the result as a small artifact. - Add a new
workflow_run-triggered workflow that downloads the artifact and comments on the PR when the autofix workflow fails andregress.ymlwas regenerated.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/autofix.yaml | Captures whether regress.yml changed during generation and uploads the result for downstream consumption. |
| .github/workflows/autofix-comment.yml | On failed autofix.ci runs, downloads the artifact and posts a PR comment with remediation steps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1767 +/- ##
==========================================
+ Coverage 71.97% 72.08% +0.11%
==========================================
Files 55 55
Lines 28009 28009
Branches 6183 6183
==========================================
+ Hits 20159 20190 +31
+ Misses 7850 7819 -31
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Derek Hower <dhower@qti.qualcomm.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| begin | ||
| real_resolver | ||
| @real_db_available = true | ||
| rescue => e |
There was a problem hiding this comment.
In real_db_available?, the rescue => e assigns an exception to e but never uses it. This can trigger RuboCop’s useless assignment/unused variable cops and adds noise. Consider changing it to rescue (or rescue StandardError) without binding the exception unless you plan to log it under UDB_TEST_FIXTURE_DEBUG.
| rescue => e | |
| rescue StandardError |
| pr_number="${{ steps.pr.outputs.number }}" | ||
| changed_files="$(gh api --paginate \ | ||
| repos/${{ github.repository }}/pulls/${pr_number}/files \ | ||
| --jq '.[].filename')" | ||
|
|
||
| if echo "$changed_files" | grep -E -q '^(\.github/workflows/regress\.yml|tools/test/regress-tests\.yaml|tools/test/regress-gh-template\.yaml|tools/test/gen_regress\.rb)$'; then | ||
| echo "needs_comment=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "needs_comment=false" >> "$GITHUB_OUTPUT" | ||
| fi |
There was a problem hiding this comment.
The workflow currently comments on any autofix.ci failure if the PR changes .github/workflows/regress.yml or one of the regress generator inputs. That can produce a misleading comment when the failure is unrelated to the regress workflow (and it will also comment even when the author already regenerated/committed regress.yml). Consider tightening the condition to only comment when the PR changes the inputs (e.g., tools/test/regress-tests.yaml, tools/test/regress-gh-template.yaml, tools/test/gen_regress.rb) and does not change .github/workflows/regress.yml, or otherwise detect the specific failure cause from the autofix run output.
| gh pr comment "${{ steps.pr.outputs.number }}" \ | ||
| --repo "${{ github.repository }}" \ | ||
| --body-file pr-comment.md |
There was a problem hiding this comment.
As written, this job will post a new PR comment every time autofix.ci fails (e.g., after each push), which can spam PR threads. Consider making the comment idempotent (search for an existing comment with a unique marker and update it, or skip posting if one already exists).
No description provided.