Close stale issues and PRs #121
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Close stale issues and PRs' | |
| on: | |
| schedule: | |
| - cron: '30 1 * * *' # Executa diariamente às 1:30 UTC | |
| workflow_dispatch: # Permite executar manualmente | |
| permissions: | |
| actions: write | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| stale: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clear stale cache | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo "Deleting _state caches via REST API..." | |
| gh api repos/${{ github.repository }}/actions/caches?key=_state \ | |
| --jq '.actions_caches[].id' 2>/dev/null | \ | |
| while read id; do | |
| echo "Deleting cache id: $id" | |
| gh api -X DELETE repos/${{ github.repository }}/actions/caches/$id || true | |
| done | |
| echo "Also clearing via cache service key prefix..." | |
| gh api repos/${{ github.repository }}/actions/caches \ | |
| --jq '.actions_caches[] | select(.key | startswith("stale")) | .id' 2>/dev/null | \ | |
| while read id; do | |
| echo "Deleting stale cache id: $id" | |
| gh api -X DELETE repos/${{ github.repository }}/actions/caches/$id || true | |
| done | |
| echo "Cache cleanup complete." | |
| - uses: actions/stale@v10 | |
| env: | |
| # Disable internal @actions/cache to prevent stale state from persisting | |
| # This forces the action to process ALL issues from scratch each run | |
| ACTIONS_CACHE_URL: '' | |
| ACTIONS_RESULTS_URL: '' | |
| with: | |
| # Configurações gerais | |
| # Fecha automaticamente issues/PRs sem atividade por 3 meses (90 dias) | |
| days-before-stale: 90 | |
| days-before-close: 0 | |
| # Labels | |
| stale-issue-label: 'stale' | |
| stale-pr-label: 'stale' | |
| # Apenas issues/PRs com label "pinned" serão ignorados pelo stale | |
| exempt-issue-labels: 'pinned' | |
| exempt-pr-labels: 'pinned' | |
| # Mensagens para Issues | |
| stale-issue-message: > | |
| This issue has been automatically closed because it has not had | |
| activity in over 3 months. Feel free to reopen if it is still relevant. | |
| Thank you for your contributions. | |
| close-issue-message: > | |
| This issue has been automatically closed due to inactivity. | |
| Feel free to reopen if you still need help. | |
| # Mensagens para PRs | |
| stale-pr-message: > | |
| This pull request has been automatically closed because it has not had | |
| activity in over 3 months. Feel free to reopen if it is still relevant. | |
| close-pr-message: false | |
| # Limites por execução (importante para repos com muitas issues!) | |
| operations-per-run: 10000 |