-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add workflows to manage and notify about issues #75890
Open
deepakrathore33
wants to merge
1
commit into
dotnet:main
Choose a base branch
from
deepakrathore33:feat/add-issue-management-workflows
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: 'Notify Area Owners to Triage Issues' | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
issues: read | ||
contents: read | ||
|
||
jobs: | ||
notify-area-owners: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Notify area owners about issues waiting for triage | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const untriagedLabel = 'untriaged'; // The label indicating the issue needs triage | ||
const daysWithoutAction = 7; // If the issue is in triage for more than 7 days | ||
const issues = await github.paginate(github.rest.issues.listForRepo, { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: untriagedLabel, | ||
state: 'open', | ||
}); | ||
|
||
const currentTime = new Date(); | ||
const timeThreshold = daysWithoutAction * 24 * 60 * 60 * 1000; | ||
|
||
for (const issue of issues) { | ||
// Check if the issue does not have the "Area-Compilers" label | ||
if (issue.labels.some(label => label.name === 'Area-Compilers')) { | ||
continue; | ||
} | ||
|
||
const issueCreatedAt = new Date(issue.created_at); | ||
const timeSinceCreated = currentTime - issueCreatedAt; | ||
|
||
// Check if the issue has been in the untriaged state for more than the threshold (7 days) | ||
if (timeSinceCreated > timeThreshold) { | ||
console.log(`Issue #${issue.number} has been in the "untriaged" state for over a week and hasn't been triaged yet.`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: 'Remind Owners About Inactive Issues' | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
issues: read | ||
contents: read | ||
|
||
jobs: | ||
remind-owners: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check for inactive issues | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const inactivityThreshold = 180; | ||
const issues = await github.paginate(github.rest.issues.listForRepo, { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'open', | ||
labels: 'untriaged', | ||
}); | ||
|
||
const currentTime = new Date(); | ||
const inactivityThresholdMs = inactivityThreshold * 24 * 60 * 60 * 1000; | ||
|
||
for (const issue of issues) { | ||
// Check if the issue does not have the "Area-Compilers" label | ||
if (issue.labels.some(label => label.name === 'Area-Compilers')) { | ||
continue; | ||
} | ||
|
||
// Check the last updated time of the issue (either comments, events, or commits) | ||
const lastUpdatedTime = new Date(issue.updated_at); | ||
const timeSinceLastUpdate = currentTime - lastUpdatedTime; | ||
|
||
if (timeSinceLastUpdate > inactivityThresholdMs) { | ||
console.log(`Issue #${issue.number} has been inactive for over ${inactivityThreshold} days.`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: "Spot Issues Missing Labels or Assignments" | ||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
issues: read | ||
contents: read | ||
|
||
jobs: | ||
check-issues: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check for issues without labels or assignees | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const issues = await github.paginate(github.rest.issues.listForRepo, { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'open', | ||
}); | ||
|
||
const noLabelsOrAssignees = issues.filter(issue => { | ||
const hasUntriagedLabel = issue.labels.some(label => label.name === 'untriaged'); | ||
const hasAreaCompilersLabel = issue.labels.some(label => label.name === 'Area-Compilers'); | ||
const hasOtherLabels = issue.labels.length > 1 || (issue.labels.length === 1 && !hasUntriagedLabel); | ||
return hasUntriagedLabel && !hasAreaCompilersLabel && !issue.assignee && !hasOtherLabels; | ||
}); | ||
|
||
for (const issue of noLabelsOrAssignees) { | ||
console.log(`Issue #${issue.number} is missing labels apart from "untriaged" or is not assigned.`); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this just logs something to the output of the workflow run? Is the expectation that we will check these outputs regularly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review! For now, the workflow just logs the issues to the output. We plan to run the workflows manually first to make sure they're catching the right issues. Once we confirm that, we can look into adding more automation like notifications.