Skip to content

Commit

Permalink
Let assignment to a milestone count as triage, in repos without the t…
Browse files Browse the repository at this point in the history
…riage labels.
  • Loading branch information
jyasskin committed Nov 7, 2023
1 parent 5e8b192 commit 06fdba0
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: actions/cache/restore@v3
id: cache-restore
with:
path: scanner/summaries
path: frontend/src/content/github
# Always replace the cache when its schema changes, but save a new version on each run.
key: ${{ hashFiles('frontend/src/lib/repo-summaries.ts') }}-${{ github.run_id }}
restore-keys: |
Expand All @@ -56,7 +56,7 @@ jobs:
# Save the cache even if the overall scan failed.
if: always()
with:
path: scanner/summaries
path: frontend/src/content/github
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: Build with Astro
run: |
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/lib/repo-summaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export const IssueSummaryInContent = z.object({
createdAt: checkInstant,
pull_request: z.object({ draft: z.boolean().default(false) }).optional(),
labels: z.array(z.string()),
milestone: z.object({
url: z.string().url(),
title: z.string(),
}).optional(),
sloTimeUsed: checkDuration,
whichSlo: SloType,
stats: z.object({
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
import GhLabel from "@components/GhLabel.astro";
import { IssueSummary } from "@lib/repo-summaries";
import { groupBySlo } from "@lib/slo";
import * as ghLabels from "@lib/triage-labels";
import { getCollection } from "astro:content";
import Layout from "../layouts/Layout.astro";
import { IssueSummary } from "@lib/repo-summaries";
const repos = await getCollection("github");
Expand Down Expand Up @@ -123,8 +123,8 @@ repoSummaries.sort(compareByKey);
the "Priority" <a href="triage-labels">triage labels</a> are
applied. If a repository doesn't have the
<a href="triage-labels">triage labels</a> created, an issue
counts as triaged once someone other than the original author
comments.
counts as triaged once it's assigned to a milestone or someone
other than the original author comments.
</li>
<li>14 days to close a <GhLabel {...ghLabels.urgent} /> issue.</li>
<li>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@octokit/plugin-throttling": "^8.1.2",
"@octokit/request-error": "^5.0.1",
"astro": "^3.2.4",
"browser-specs": "^3.67.0",
"browser-specs": "^3.68.0",
"colorjs.io": "^0.4.5",
"commander": "^11.1.0",
"node-fetch": "^3.3.2",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 21 additions & 5 deletions scanner/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ const issueFragment = gql(`fragment issueFragment on IssueConnection {
name
}
}
milestone {
url
title
}
timelineItems(first:100, itemTypes:[LABELED_EVENT, UNLABELED_EVENT, CLOSED_EVENT, REOPENED_EVENT]){
totalCount
pageInfo {
Expand Down Expand Up @@ -111,6 +115,10 @@ const prFragment = gql(`fragment prFragment on PullRequestConnection {
name
}
}
milestone {
url
title
}
timelineItems(first:100, itemTypes:[READY_FOR_REVIEW_EVENT, CONVERT_TO_DRAFT_EVENT, LABELED_EVENT, UNLABELED_EVENT, CLOSED_EVENT, REOPENED_EVENT]){
totalCount
pageInfo {
Expand Down Expand Up @@ -470,7 +478,7 @@ async function analyzeRepo(org: string, repoName: string, globalStats: GlobalSta
if (issue.timelineItems.nodes.some(item =>
item.__typename === 'LabeledEvent' && item.label.name === NEEDS_REPORTER_FEEDBACK)) {
needAllComments.push(issue);
} else if (!result.labelsPresent) {
} else if (!result.labelsPresent && !issue.milestone) {
// We only need to see a few comments to see if someone other than the initial author has
// commented. This'll miss if the initial author has a long conversation with themself, but
// that should be rare.
Expand Down Expand Up @@ -498,10 +506,18 @@ async function analyzeRepo(org: string, repoName: string, globalStats: GlobalSta
if (issue.__typename === 'PullRequest') {
info.pull_request = { draft: issue.isDraft };
}
if (!result.labelsPresent && issue.timelineItems.nodes.some(timelineItem =>
['IssueComment', 'PullRequestReview', 'PullRequestReviewThread'].includes(timelineItem.__typename)
&& info.author !== timelineItem.author?.login
)) {
if (issue.milestone) {
info.milestone = {
url: issue.milestone.url,
title: issue.milestone.title,
};
}
if (!result.labelsPresent && (
issue.milestone ||
issue.timelineItems.nodes.some(timelineItem =>
['IssueComment', 'PullRequestReview', 'PullRequestReviewThread'].includes(timelineItem.__typename)
&& info.author !== timelineItem.author?.login
))) {
// If the repository doesn't have the triage labels, and an issue or PR has a comment from
// someone other than its creator, assume that person has also triaged the issue.
info.whichSlo = "none";
Expand Down

0 comments on commit 06fdba0

Please sign in to comment.