PageIndex/.github/workflows/remove-autoclose-label.yml
copilot-swe-agent[bot] b3cb9531a4 Add GitHub Actions workflows for issue deduplication and auto-close
Co-authored-by: BukeLy <19304666+BukeLy@users.noreply.github.com>
2026-03-02 03:54:18 +00:00

48 lines
1.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Removes the "autoclose" label whenever a human (non-bot) posts a new comment
# on an issue that carries the label. This resets the inactivity clock.
name: Remove Autoclose Label on Human Activity
on:
issue_comment:
types: [created]
permissions:
issues: write
jobs:
remove-autoclose:
# Only run for issue comments (not PR comments)
if: ${{ github.event.issue.pull_request == null }}
runs-on: ubuntu-latest
steps:
- name: Remove autoclose label if human commented
uses: actions/github-script@v7
with:
script: |
const actor = context.actor;
// Ignore bot accounts
if (actor.endsWith('[bot]') || actor === 'github-actions') {
core.info(`Skipping bot comment from ${actor}`);
return;
}
const issue = context.payload.issue;
const labels = (issue.labels || []).map(l => l.name);
if (!labels.includes('autoclose')) {
core.info('Issue does not have "autoclose" label nothing to do.');
return;
}
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
name: 'autoclose',
});
core.info(
`Removed "autoclose" label from #${issue.number} ` +
`after human activity by ${actor}`
);