You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add git history analysis to go flaky tests (#1029)
* feat: add Git author tracking functionality
Add Git client implementation to track test authors:
- Find test files using grep search through repository
- Extract commit history using git log -L for specific test functions
- Filter commits to last 6 months to focus on recent contributors
- Add FilePath and RecentCommits to FlakyTest struct
- Update action to include repository-directory input
- Enhance test reporting with author information
Builds on PR1's Loki analysis with Git history tracking.
GitHub username resolution will be added in PR3.
# Conflicts:
# actions/go-flaky-tests/cmd/go-flaky-tests/analyzer.go
* Format Go code with gofmt
* Revert "Remove PR2-related features from documentation"
This reverts commit 9a29cc3.
* Remove unnecessary function
* Adapt tests
* Pull author resolution out of git client
* Revert "Remove repository-directory parameter from local script"
This reverts commit 085c861.
* Remove redundant author printing
| `loki-password` | Password for Loki authentication. If using Grafana Cloud, then the access policy for this token needs the `logs:read` scope. | ❌ | - |
43
-
| `repository` | Repository name in 'owner/repo' format | ✅ | - |
44
-
| `time-range` | Time range for the query (e.g., '1h', '24h', '7d') | ❌ | `1h` |
45
-
| `top-k` | Include only the top K flaky tests by distinct branches count | ❌ | `3` |
| `loki-password` | Password for Loki authentication. If using Grafana Cloud, then the access policy for this token needs the `logs:read` scope. | ❌ | - |
44
+
| `repository` | Repository name in 'owner/repo' format | ✅ | - |
45
+
| `time-range` | Time range for the query (e.g., '1h', '24h', '7d') | ❌ | `1h` |
46
+
| `repository-directory` | Relative path to the directory with a git repository | ❌ | `${{ github.workspace }}` |
47
+
| `top-k` | Include only the top K flaky tests by distinct branches count | ❌ | `3` |
46
48
47
49
## Outputs
48
50
@@ -57,6 +59,8 @@ jobs:
57
59
1. **Fetch Logs**: Queries Loki for test failure logs within the specified time range
58
60
2. **Parse Failures**: Extracts test names, branches, and workflow URLs from logs
59
61
3. **Detect Flaky Tests**: Identifies tests that fail on multiple branches or multiple times on main/master
62
+
4. **Find Test Files**: Locates test files in the repository using grep
63
+
5. **Extract Authors**: Uses `git log -L` to find recent commits that modified each test
60
64
61
65
## Flaky Test Detection Logic
62
66
@@ -76,13 +80,16 @@ Run the analysis locally using the provided script:
0 commit comments