Skip to content
Draft
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
81 changes: 81 additions & 0 deletions .github/workflows/close-inactive-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Close Issues with User Inactivity

on:
workflow_call:
inputs:
days_before_close:
description: 'Number of days of user inactivity before closing issues'
required: false
default: 10
type: number
stale_issue_message:
description: 'Message to post when marking issues as stale due to user inactivity'
required: false
default: 'This issue has been automatically marked as stale because we have not received a response from the issue author for {{days-before-stale}} days. We are waiting for your input to continue helping you. If you are still experiencing this issue, please comment to keep it open. Otherwise, it will be closed automatically in a few days.'
type: string
close_issue_message:
description: 'Message to post when closing stale issues'
required: false
default: 'This issue has been automatically closed due to lack of response from the issue author. If you are still experiencing this issue, please feel free to reopen it or create a new issue with the requested information.'
type: string
exempt_issue_labels:
description: 'Comma-separated list of labels that exempt issues from being closed'
required: false
default: 'pinned,security,waiting-for-maintainer,under-investigation'
type: string
close_issue_reason:
description: 'Reason for closing the issue'
required: false
default: 'not_planned'
type: string
secrets:
GITHUB_TOKEN:
description: 'GitHub token with issue management permissions'
required: true

jobs:
check-and-close-inactive:
runs-on: ubuntu-latest
permissions:
issues: write
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Close issues with user inactivity
uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

# Configuration for issues only
days-before-stale: ${{ inputs.days_before_close }}
days-before-close: 1 # Close 1 day after marking as stale

# Disable PR handling
days-before-pr-stale: -1
days-before-pr-close: -1

# Messages
stale-issue-message: ${{ inputs.stale_issue_message }}
close-issue-message: ${{ inputs.close_issue_message }}

# Labels and exemptions
stale-issue-label: 'stale-user-inactive'
exempt-issue-labels: ${{ inputs.exempt_issue_labels }}

# Remove stale label when user responds
remove-stale-when-updated: true

# Close issues with specified reason
close-issue-reason: ${{ inputs.close_issue_reason }}

# Configuration to improve targeting
ascending: true
operations-per-run: 50

# Only process issues that don't have recent activity from the author
# This helps ensure we're only closing when waiting for user response
ignore-updates: false
ignore-issue-updates: false
7 changes: 7 additions & 0 deletions workflow-templates/call-close-inactive-issues.properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "call-close-inactive-issues",
"description": "Automatically close issues with user inactivity after 10 days",
"iconName": "issue-closed",
"categories": ["automation", "issues"],
"filePatterns": ["*.md", "README.md"]
}
24 changes: 24 additions & 0 deletions workflow-templates/call-close-inactive-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Close Issues with User Inactivity

on:
schedule:
# Run daily at 2 AM UTC to check for inactive issues
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
days_before_close:
description: 'Days of user inactivity before closing'
required: false
default: '10'
type: string

jobs:
close-inactive:
uses: serpapps/.github/.github/workflows/close-inactive-issues.yml@main
with:
days_before_close: ${{ github.event.inputs.days_before_close && fromJSON(github.event.inputs.days_before_close) || 10 }}
stale_issue_message: 'This issue has been automatically marked as stale because we have not received a response from you for {{days-before-stale}} days. We are waiting for your input to continue helping you. If you are still experiencing this issue, please comment to keep it open. Otherwise, it will be closed automatically tomorrow.'
close_issue_message: 'This issue has been automatically closed due to lack of response from the issue author. If you are still experiencing this issue, please feel free to reopen it or create a new issue with the requested information.'
exempt_issue_labels: 'pinned,security,waiting-for-maintainer,under-investigation,enhancement'
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}