mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-04-24 23:56:21 +02:00
48 lines
1.5 KiB
YAML
48 lines
1.5 KiB
YAML
# 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}`
|
||
);
|