Skip to content

Commit a107107

Browse files
[gh-aw] Add nightly-fix-finder agentic workflow (#11352)
## Summary Adds a **nightly agentic workflow** (`gh aw`) that automatically scans the repo for code quality improvements, files issues, and assigns Copilot (Claude Opus 4.6) to fix them. ## What it does Each night, the workflow: 1. Runs a pre-agent bash step that randomly selects one of 9 scan categories 2. Collects scan data for ONLY that category (prevents the agent from gravitating to favorites) 3. The AI agent investigates the findings and picks one specific, actionable improvement 4. Creates a focused GitHub issue describing the problem and fix 5. Assigns Copilot to implement the fix automatically Can also be triggered manually via `workflow_dispatch` with a category dropdown. ## Scan Categories | # | Category | What it scans | |---|----------|---------------| | 0 | TODO/FIXME/HACK Comments | Stale TODO/FIXME/HACK comments that should be resolved | | 1 | Nullable Reference Types | C# files missing `#nullable enable` that should be opted in | | 2 | Obsolete API Usage | Uses of `[Obsolete]` members that should be updated | | 3 | Performance Anti-patterns | Sync-over-async, string concat in loops, unnecessary allocations | | 4 | Missing XML Documentation | Public APIs in `src/Mono.Android/` without XML doc comments | | 5 | General Mistakes | Random source files reviewed for real bugs, logic errors, dead code | | 6 | Unused Using Directives | Files with excessive using directives that could be cleaned up | | 7 | Error Handling | Bare `catch (Exception)` blocks that swallow errors | | 8 | String Literals in Error Messages | Hardcoded error strings that should be in `Properties.Resources` with XA codes | ## Files - `.github/workflows/nightly-fix-finder.md` — Workflow source (frontmatter + agent prompt) - `.github/workflows/nightly-fix-finder.lock.yml` — Compiled workflow (auto-generated by `gh aw compile`) - `.github/skills/android-reviewer/references/msbuild-rules.md` — Updated XA error code doc requirement ## Setup required - `ANDROID_TEAM_PAT` secret must be created in the repo for `assign_to_agent` to work (fine-grained PAT with Issues R/W, Contents R, Pull Requests R/W) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 33b81dc commit a107107

3 files changed

Lines changed: 1636 additions & 1 deletion

File tree

.github/skills/android-reviewer/references/msbuild-rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ causes broken builds for every .NET Android developer.
1616
| **Use `AsyncTask` for background work** | Tasks that need `async`/`await` should extend `AsyncTask` and override `RunTaskAsync()`. It handles `Yield()`, `try`/`finally`, and `Reacquire()` automatically. Use `AsyncTask.Log*` helpers for logging from the background thread — calling `Log.LogMessage` directly can cause IDE hangs. Use full paths on background threads (`Environment.CurrentDirectory` may differ if the task is on another MSBuild node). Leverage the `WhenAll` extension for parallel work over `ITaskItem[]`. |
1717
| **Return `!Log.HasLoggedErrors`** | `RunTask()` must return `!Log.HasLoggedErrors`. Do not return `true`/`false` directly — it skips the centralized error-tracking mechanism. |
1818
| **Use `Log.LogCoded*` methods** | Errors and warnings must use `Log.LogCodedError("XA####", …)` or `Log.LogCodedWarning("XA####", …)` — never bare `Log.LogError` without a code. Error messages should come from `Properties.Resources`. |
19-
| **XA error codes** | Error codes follow `XA####` (4+ digits). New codes must not collide with existing ones. Check `Properties/Resources.cs.resx` for used codes. Every new code must have a documentation entry and be localized. (Postmortem `#10`) |
19+
| **XA error codes** | Error codes follow `XA####` (4+ digits). New codes must not collide with existing ones. Check `Properties/Resources.cs.resx` for used codes. Every new code must have a corresponding markdown documentation file at `Documentation/docs-mobile/messages/xa####.md` (following the existing format with frontmatter, example messages, issue explanation, and solution), and the code must be added to the table of contents in `Documentation/docs-mobile/messages/index.md`. (Postmortem `#10`) |
2020
| **`[Required]` properties** | `[Required]` properties must be non-nullable with a default: `public string Foo { get; set; } = "";` or `public ITaskItem[] Bar { get; set; } = [];`. Non-`[Required]` and `[Output]` properties must be nullable (`string?`, `ITaskItem[]?`). Mark properties `[Required]` when the task crashes without them. (Postmortem `#51`) |
2121
| **`UsingTask` for internal tasks** | `<UsingTask/>` elements for `xa-prep-tasks` and `BootstrapTasks` (internal, not shipped) must use `TaskFactory="TaskHostFactory"` and `Runtime="NET"`. Do NOT add these attributes to shipped task definitions in `Xamarin.Android.Common.targets` or `Microsoft.Android.Sdk/*.targets`. |
2222
| **Caching with `RegisterTaskObject`** | Use `BuildEngine4.RegisterTaskObject()` (via the `RegisterTaskObjectAssemblyLocal()` extension method) instead of `static` variables for sharing data between tasks or across builds. Use `as` for casts to avoid `InvalidCastException`. Cache keys should include context that invalidates properly (device target, file path, version). Cache primitive/small values only. |

0 commit comments

Comments
 (0)