name: Issue Close Require on: schedule: - cron: "0 1 * * *" permissions: issues: write jobs: issue-close-require: runs-on: ubuntu-latest steps: - name: Close inactive issues awaiting user feedback env: GH_TOKEN: ${{ github.token }} INACTIVE_DAY: "7" run: | set -euo pipefail cutoff="$(date -u -d "${INACTIVE_DAY} days ago" +%Y-%m-%dT%H:%M:%SZ)" body="$(cat <<'EOF' If you do not provide feedback for more than 37 days, we will close the issue and you can either reopen it or submit a new issue. 您超过 37 天未反馈信息,我们将关闭该 issue,如有需求您可以重新打开或者提交新的 issue。 EOF )" # Trim leading indentation from heredoc lines for a cleaner comment. body="$(printf '%s\n' "$body" | sed 's/^[[:space:]]*//')" gh issue list \ --repo "${{ github.repository }}" \ --state open \ --label "stale" \ --label "state/awaiting user feedback" \ --limit 1000 \ --json number,updatedAt \ | jq -c --arg cutoff "$cutoff" '.[] | select(.updatedAt < $cutoff)' \ | while IFS= read -r issue; do number="$(echo "$issue" | jq -r .number)" echo "Closing issue #${number}" gh issue close "$number" \ --repo "${{ github.repository }}" \ --comment "$body" done