Skip to main content

이 버전의 GitHub Enterprise Server는 다음 날짜에 중단됩니다. 2025-08-27. 중요한 보안 문제에 대해서도 패치 릴리스가 이루어지지 않습니다. 더 뛰어난 성능, 향상된 보안, 새로운 기능을 위해 최신 버전의 GitHub Enterprise Server로 업그레이드합니다. 업그레이드에 대한 도움말은 GitHub Enterprise 지원에 문의하세요.

Closing inactive issues

You can use GitHub Actions to comment on or close issues that have been inactive for a certain period of time.

참고 항목

GitHub 호스트 실행기는 현재 GitHub Enterprise Server에서 지원되지 않습니다.

Introduction

This tutorial demonstrates how to use the actions/stale action to comment on and close issues that have been inactive for a certain period of time. For example, you can comment if an issue has been inactive for 30 days to prompt participants to take action. Then, if no additional activity occurs after 14 days, you can close the issue.

In the tutorial, you will first make a workflow file that uses the actions/stale action. Then, you will customize the workflow to suit your needs.

Creating the workflow

  1. 이 프로젝트 관리 워크플로를 적용할 리포지토리를 선택합니다. 쓰기 권한이 있는 기존 리포지토리를 사용하거나 새 리포지토리를 만들 수 있습니다. 리포지토리 만들기에 대한 자세한 내용은 새 리포지토리 만들기을(를) 참조하세요.

  2. 리포지토리에서 YOUR_WORKFLOW를 선택한 이름으로 바꾸는 .github/workflows/YOUR_WORKFLOW.yml 파일을 만듭니다. 워크플로 파일입니다. GitHub에서 새 파일을 만드는 방법에 대한 자세한 내용은 새 파일 만들기을(를) 참조하세요.

  3. Copy the following YAML contents into your workflow file.

    YAML
    name: Close inactive issues
    on:
      schedule:
        - cron: "30 1 * * *"
    
    jobs:
      close-issues:
        runs-on: ubuntu-latest
        permissions:
          issues: write
          pull-requests: write
        steps:
          - uses: actions/stale@v9
            with:
              days-before-issue-stale: 30
              days-before-issue-close: 14
              stale-issue-label: "stale"
              stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
              close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
              days-before-pr-stale: -1
              days-before-pr-close: -1
              repo-token: ${{ secrets.GITHUB_TOKEN }}
    
  4. Customize the parameters in your workflow file:

    • Change the value for on.schedule to dictate when you want this workflow to run. In the example above, the workflow will run every day at 1:30 UTC. For more information about scheduled workflows, see 워크플로를 트리거하는 이벤트.
    • Change the value for days-before-issue-stale to the number of days without activity before the actions/stale action labels an issue. If you never want this action to label issues, set this value to -1.
    • Change the value for days-before-issue-close to the number of days without activity before the actions/stale action closes an issue. If you never want this action to close issues, set this value to -1.
    • Change the value for stale-issue-label to the label that you want to apply to issues that have been inactive for the amount of time specified by days-before-issue-stale.
    • Change the value for stale-issue-message to the comment that you want to add to issues that are labeled by the actions/stale action.
    • Change the value for close-issue-message to the comment that you want to add to issues that are closed by the actions/stale action.
  5. 워크플로 파일을 리포지토리의 기본 분기에 커밋합니다. 자세한 내용은 새 파일 만들기을(를) 참조하세요.

Expected results

Based on the schedule parameter (for example, every day at 1:30 UTC), your workflow will find issues that have been inactive for the specified period of time and will add the specified comment and label. Additionally, your workflow will close any previously labeled issues if no additional activity has occurred for the specified period of time.

참고 항목

GitHub Actions 워크플로가 실행되는 로드가 많은 기간 동안 schedule 이벤트가 지연될 수 있습니다. 높은 로드 시간에는 매 시간의 시작이 포함됩니다. 부하가 높으면 대기 중인 작업 일부가 삭제될 수 있습니다. 지연 가능성을 줄이려면 워크플로가 다른 시간에 실행되도록 예약합니다.

You can view the history of your workflow runs to see this workflow run periodically. For more information, see Viewing workflow run history.

This workflow will only label and/or close 30 issues at a time in order to avoid exceeding a rate limit. You can configure this with the operations-per-run setting. For more information, see the actions/stale action documentation.

Next steps

  • To learn more about additional things you can do with the actions/stale action, like closing inactive pull requests, ignoring issues with certain labels or milestones, or only checking issues with certain labels, see the actions/stale action documentation.
  • Search GitHub for examples of workflows using this action.