|
| 1 | +name: Stale issues handler |
| 2 | + |
| 3 | +on: |
| 4 | + push: # when push this files to branches.... |
| 5 | + branches: |
| 6 | + - 'main' |
| 7 | + paths: |
| 8 | + - '.github/workflows/stale-issues.yml' # - this workflow |
| 9 | + workflow_dispatch: # manually |
| 10 | + schedule: # or |
| 11 | + - cron: "0 0,6,12,18 * * *" # every 6 hour at o'clock |
| 12 | + |
| 13 | +permissions: |
| 14 | + # no checkouts needed |
| 15 | + contents: none |
| 16 | + # needs issue labels and comments CRUD management |
| 17 | + issues: write |
| 18 | + |
| 19 | +# This allows a subsequently queued workflow run to interrupt/wait for previous runs |
| 20 | +concurrency: |
| 21 | + group: '${{ github.workflow }}' |
| 22 | + cancel-in-progress: false # true: interrupt, false = wait for |
| 23 | + |
| 24 | +jobs: |
| 25 | + stale: |
| 26 | + name: Stale issues |
| 27 | + runs-on: ubuntu-latest |
| 28 | + outputs: |
| 29 | + staled: ${{ steps.set-staled.outputs.numbers }} |
| 30 | + closed: ${{ steps.set-closed.outputs.numbers }} |
| 31 | + steps: |
| 32 | + - uses: actions/stale@v5 |
| 33 | + id: stale |
| 34 | + with: |
| 35 | + operations-per-run: 30 |
| 36 | + days-before-stale: 1 |
| 37 | + days-before-close: 1 |
| 38 | + days-before-pr-stale: -1 |
| 39 | + days-before-pr-close: -1 |
| 40 | + stale-issue-label: "stale" |
| 41 | + close-issue-label: "stale: closed" |
| 42 | + stale-issue-message: | |
| 43 | + This issue has been automatically marked as stale because it has not had recent activity during last 60 days :sleeping: |
| 44 | +
|
| 45 | + It will be closed in 15 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation. |
| 46 | +
|
| 47 | + There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. This repository is a DavorpaTech's open source project not owned by a single for-profit company. It's a community-driven initiative ruled under open governance model. |
| 48 | +
|
| 49 | + Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here. |
| 50 | +
|
| 51 | + Thank you for your patience :heart: |
| 52 | + close-issue-message: | |
| 53 | + This issue has been automatically closed because it has been inactive during the last 15 days since being marked as stale. |
| 54 | +
|
| 55 | + Anyway, thank you for your interest of contributing :heart: |
| 56 | + close-issue-reason: not_planned |
| 57 | + exempt-issue-labels: "blocked,must,should,keep,📌 pinned" |
| 58 | + remove-issue-stale-when-updated: true |
| 59 | + - name: Set staled numbers |
| 60 | + id: set-staled |
| 61 | + run: | |
| 62 | + echo $INPUT_JSON \ |
| 63 | + | jq --compact-output '[.[] | .number]' \ |
| 64 | + | sed -e 's/^/::set-output name=numbers::/' |
| 65 | + env: |
| 66 | + INPUT_JSON: ${{ steps.stale.outputs.staled-issues-prs }} |
| 67 | + - name: Set closed numbers |
| 68 | + id: set-closed |
| 69 | + run: | |
| 70 | + echo $INPUT_JSON \ |
| 71 | + | jq --compact-output '[.[] | .number]' \ |
| 72 | + | sed -e 's/^/::set-output name=numbers::/' |
| 73 | + env: |
| 74 | + INPUT_JSON: ${{ steps.stale.outputs.closed-issues-prs }} |
| 75 | + |
| 76 | + - name: Write GitHub job summary |
| 77 | + run: | |
| 78 | + echo "### Staled" \ |
| 79 | + >> $GITHUB_STEP_SUMMARY |
| 80 | + echo "$STALED" \ |
| 81 | + | jq --raw-output 'map("* [#\(.)](\(env.GITHUB_PUBLIC_URL)/\(.))") | join("\n")' \ |
| 82 | + >> $GITHUB_STEP_SUMMARY |
| 83 | +
|
| 84 | + echo "### Closed" \ |
| 85 | + >> $GITHUB_STEP_SUMMARY |
| 86 | + echo "$CLOSED" \ |
| 87 | + | jq --raw-output 'map("* [#\(.)](\(env.GITHUB_PUBLIC_URL)/\(.))") | join("\n")' \ |
| 88 | + >> $GITHUB_STEP_SUMMARY |
| 89 | + env: |
| 90 | + GITHUB_PUBLIC_URL: ${{ format('{0}/{1}/issues', github.server_url, github.repository) }} |
| 91 | + STALED: ${{ steps.set-staled.outputs.numbers }} |
| 92 | + CLOSED: ${{ steps.set-closed.outputs.numbers }} |
| 93 | + |
| 94 | + on-close-label-cleanup: |
| 95 | + name: "Clean labels on close #${{ matrix.value }}" |
| 96 | + if: ${{ fromJSON(needs.stale.outputs.closed).length > 0 }} |
| 97 | + needs: [stale] |
| 98 | + runs-on: ubuntu-latest |
| 99 | + strategy: |
| 100 | + matrix: |
| 101 | + value: ${{ fromJSON(needs.stale.outputs.closed) }} |
| 102 | + max-parallel: 10 # max number of spawned jobs that can be in progress |
| 103 | + fail-fast: false # don't cancel other spawned matrix jobs |
| 104 | + steps: |
| 105 | + - name: Remove stale labels |
| 106 | + uses: actions-ecosystem/action-remove-labels@v1 |
| 107 | + with: |
| 108 | + repo: ${{ github.repository }} |
| 109 | + number: ${{ matrix.value }} |
| 110 | + labels: | |
| 111 | + stale |
| 112 | +
|
| 113 | +
|
0 commit comments