Skip to content

No Response

No Response #3

Workflow file for this run

# A workflow to close issues where the author hasn't responded to a request for
# more information; see https://github.com/actions/stale.
name: No Response
# Run as a daily cron.
on:
schedule:
# Every day at 8am
- cron: '*/5 * * * *'
# All permissions not specified are set to 'none'.
permissions:
issues: write
pull-requests: write
jobs:
no-response:
runs-on: ubuntu-latest
steps:
- name: Check issues where last comment is not by repo owner
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const issues = await github.rest.issues.listForRepo({
owner,
repo,
state: 'open'
});
for (const issue of issues.data) {
const comments = await github.rest.issues.listComments({
owner,
repo,
issue_number: issue.number
});
if (comments.data.length > 0) {
const lastComment = comments.data[comments.data.length - 1];
if (lastComment.user.login !== owner) {
console.log(`Issue #${issue.number} last commented by ${lastComment.user.login}`);
// Perform your action here, e.g., tagging the issue, adding a comment, etc.
}
}
}