diff --git a/.github/workflows/notify-owner-to-triage.yml b/.github/workflows/notify-owner-to-triage.yml new file mode 100644 index 0000000000000..7f504669bb27e --- /dev/null +++ b/.github/workflows/notify-owner-to-triage.yml @@ -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.`); + } + } diff --git a/.github/workflows/remind-about-inactive-issues.yml b/.github/workflows/remind-about-inactive-issues.yml new file mode 100644 index 0000000000000..92c9d40db765a --- /dev/null +++ b/.github/workflows/remind-about-inactive-issues.yml @@ -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.`); + } + } diff --git a/.github/workflows/spot-missing-labels.yml b/.github/workflows/spot-missing-labels.yml new file mode 100644 index 0000000000000..79b9016c9739b --- /dev/null +++ b/.github/workflows/spot-missing-labels.yml @@ -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.`); + } \ No newline at end of file