Files
OrcaSlicer/.github/workflows/unstale-on-comment.yml
T
Kris Austin 7932cd23f7 Remove the stale label as soon as someone comments (#17709)
stale.yml only removes the label when its daily run gets back to an
issue or PR, which can take a few days. A new workflow removes it when
a user comments on an open item that has the label.

The stale bot also checks exemptions before activity, so a stale item
that later gets an assignee or milestone, becomes a draft, or loses
"wait for response" is never checked again and keeps its label. A new
step in stale.yml removes the label from those.
2026-11-19 08:43:40 -06:00

37 lines
1.2 KiB
YAML

name: Remove stale label on comment
# stale.yml only removes the label when its daily run gets back to an item,
# which can take a few days. This removes it as soon as someone comments.
on:
issue_comment:
types: [created]
permissions:
issues: write
pull-requests: write
jobs:
unstale:
if: >-
github.repository == 'OrcaSlicer/OrcaSlicer' &&
github.event.issue.state == 'open' &&
github.event.comment.user.type == 'User' &&
contains(github.event.issue.labels.*.name, 'stale')
runs-on: ubuntu-latest
steps:
- name: Remove the stale label
env:
GH_TOKEN: ${{ github.token }}
NUMBER: ${{ github.event.issue.number }}
run: |
# "Close with comment" sends the event while the issue is still open.
state=$(gh api "repos/$GITHUB_REPOSITORY/issues/$NUMBER" --jq .state)
if [ "$state" != open ]; then
exit 0
fi
# A 404 means another comment or the stale run already removed it.
if ! gh api -X DELETE "repos/$GITHUB_REPOSITORY/issues/$NUMBER/labels/stale" --silent 2> err.txt; then
cat err.txt >&2
grep -q "HTTP 404" err.txt
fi