Skip to content
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
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/notify-owner-to-triage.yml
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.`);
Copy link
Member

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?

Copy link
Contributor Author

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.

}
}
46 changes: 46 additions & 0 deletions .github/workflows/remind-about-inactive-issues.yml
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.`);
}
}
36 changes: 36 additions & 0 deletions .github/workflows/spot-missing-labels.yml
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.`);
}