Skip to content
Merged
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
63 changes: 63 additions & 0 deletions .github/workflows/close-needs-author-feedback.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Close inactive author feedback issues

on:
schedule:
- cron: "0 9 * * *"
workflow_dispatch:
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow_dispatch trigger should have empty braces for consistency with the codeQL.yml workflow in this repository (line 15), which uses explicit empty object notation. Update to 'workflow_dispatch: {}' for consistency.

Suggested change
workflow_dispatch:
workflow_dispatch: {}

Copilot uses AI. Check for mistakes.

permissions:
contents: read
issues: write

jobs:
close-inactive:
runs-on: ubuntu-latest
steps:
- name: Close issues waiting on author feedback
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const label = "Needs Author Feedback";
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The label "Needs Author Feedback" does not match the existing label format used in the repository. The existing policy in .github/policies/resourceManagement.yml uses "Needs: Author Feedback" (with a colon). This inconsistency means the workflow will target different issues than intended. Update the label to match the existing convention: "Needs: Author Feedback".

Suggested change
const label = "Needs Author Feedback";
const label = "Needs: Author Feedback";

Copilot uses AI. Check for mistakes.
const daysInactive = 7;
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 7-day inactivity period conflicts with the existing policy timing. The current resourceManagement.yml policy uses a 7-day total process: adds a warning comment after 4 days of inactivity, then closes after 3 more days. This provides users with advance notice. The new workflow closes issues immediately after 7 days without prior warning. Consider aligning with the existing two-stage approach to provide better user experience, or clearly document why a different approach is needed.

Copilot uses AI. Check for mistakes.
const cutoff = new Date(Date.now() - daysInactive * 24 * 60 * 60 * 1000);

const { owner, repo } = context.repo;
const issues = await github.paginate(github.rest.issues.listForRepo, {
owner,
repo,
state: "open",
labels: label,
per_page: 100,
sort: "updated",
direction: "asc",
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow retrieves all open issues with the label and filters them in memory. For repositories with many issues, this could be inefficient. Consider adding the 'since' parameter to the API call to filter issues at the API level based on the cutoff date, reducing the amount of data transferred and processed.

Suggested change
direction: "asc",
direction: "asc",
since: cutoff.toISOString(),

Copilot uses AI. Check for mistakes.
});

for (const issue of issues) {
if (issue.pull_request) {
continue;
}

const updatedAt = new Date(issue.updated_at);
if (updatedAt > cutoff) {
continue;
}

const body = [
"We haven't heard back in 7 days, so we're automatically closing this issue.",
"If you still need help, please reply and we can reopen it."
Comment on lines +47 to +48
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The closing message should match the established tone and format used in the existing policy. The current resourceManagement.yml uses a more formal message structure that includes markdown formatting for emphasis. Consider using a message consistent with the existing policy's style.

Suggested change
"We haven't heard back in 7 days, so we're automatically closing this issue.",
"If you still need help, please reply and we can reopen it."
"**This issue has been automatically closed due to lack of author feedback after 7 days.**",
"",
"If you still require assistance, please comment on this issue and we will be happy to reopen it."

Copilot uses AI. Check for mistakes.
].join("\n\n");

try {
await github.rest.issues.createComment({ owner, repo, issue_number: issue.number, body });
} catch (error) {
console.warn(`Skipping issue #${issue.number} because of an error while adding the notice: ${error}`);
continue;
}

try {
await github.rest.issues.update({ owner, repo, issue_number: issue.number, state: "closed" });
} catch (error) {
console.warn(`Skipping issue #${issue.number} because of an error while processing closure: ${error}`);
}
Comment on lines +58 to +62
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the issue closure fails but the comment was successfully posted, the issue will remain open with a closure notice that's inaccurate. The existing resourceManagement.yml policy handles this atomically through its action system. Consider adding a state check or removing the comment if closure fails to maintain consistency between the comment message and actual issue state.

Copilot uses AI. Check for mistakes.
}
Comment on lines +1 to +63
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow duplicates functionality already handled by the existing GitOps policy in .github/policies/resourceManagement.yml (lines 11-43). The existing policy already closes issues with "Needs: Author Feedback" label after 7 days of inactivity (4 days for warning + 3 days to close). Having two separate systems managing the same process creates potential conflicts, confusion, and maintenance overhead. Consider whether this workflow is necessary, or if the existing policy should be modified instead.

Suggested change
name: Close inactive author feedback issues
on:
schedule:
- cron: "0 9 * * *"
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
close-inactive:
runs-on: ubuntu-latest
steps:
- name: Close issues waiting on author feedback
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const label = "Needs Author Feedback";
const daysInactive = 7;
const cutoff = new Date(Date.now() - daysInactive * 24 * 60 * 60 * 1000);
const { owner, repo } = context.repo;
const issues = await github.paginate(github.rest.issues.listForRepo, {
owner,
repo,
state: "open",
labels: label,
per_page: 100,
sort: "updated",
direction: "asc",
});
for (const issue of issues) {
if (issue.pull_request) {
continue;
}
const updatedAt = new Date(issue.updated_at);
if (updatedAt > cutoff) {
continue;
}
const body = [
"We haven't heard back in 7 days, so we're automatically closing this issue.",
"If you still need help, please reply and we can reopen it."
].join("\n\n");
try {
await github.rest.issues.createComment({ owner, repo, issue_number: issue.number, body });
} catch (error) {
console.warn(`Skipping issue #${issue.number} because of an error while adding the notice: ${error}`);
continue;
}
try {
await github.rest.issues.update({ owner, repo, issue_number: issue.number, state: "closed" });
} catch (error) {
console.warn(`Skipping issue #${issue.number} because of an error while processing closure: ${error}`);
}
}
# (File deleted)

Copilot uses AI. Check for mistakes.
Loading