From 250fec85e1e13d3890fc7867829dca86765d85d7 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Wed, 29 Apr 2026 00:51:56 -0700 Subject: [PATCH] ci: react to autoclose on issues --- .../maintainer-command-reactions.yml | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/maintainer-command-reactions.yml b/.github/workflows/maintainer-command-reactions.yml index 87f8bde7046..0ad8f0e3f5c 100644 --- a/.github/workflows/maintainer-command-reactions.yml +++ b/.github/workflows/maintainer-command-reactions.yml @@ -12,14 +12,14 @@ concurrency: jobs: react: - if: ${{ github.event.issue.pull_request && !endsWith(github.actor, '[bot]') }} + if: ${{ !endsWith(github.actor, '[bot]') }} runs-on: ubuntu-24.04 permissions: issues: write env: CLOWNFISH_APP_ID: ${{ vars.CLOWNFISH_APP_ID || secrets.CLOWNFISH_APP_ID }} CLOWNFISH_APP_AUTH_ENABLED: ${{ secrets.CLOWNFISH_APP_PRIVATE_KEY != '' && (vars.CLOWNFISH_APP_ID != '' || secrets.CLOWNFISH_APP_ID != '') && '1' || '0' }} - MAINTAINER_COMMAND_REACTIONS: ${{ vars.MAINTAINER_COMMAND_REACTIONS || '/automerge,/autoclose,/merge,/land,/landpr' }} + MAINTAINER_COMMAND_REACTIONS: ${{ vars.MAINTAINER_COMMAND_REACTIONS || '/automerge,/autoclose,/clownfish autoclose,/merge,/land,/landpr' }} steps: - name: Create Clownfish reaction token id: clownfish-token @@ -41,11 +41,6 @@ jobs: const comment = context.payload.comment; const issue = context.payload.issue; - if (!issue.pull_request) { - core.info("Skipping command reaction because the comment is not on a pull request."); - return; - } - const commands = (process.env.MAINTAINER_COMMAND_REACTIONS || "") .split(",") .map((command) => command.trim()) @@ -60,6 +55,17 @@ jobs: return; } + const isAutocloseCommand = + commandLine === "/autoclose" || + commandLine.startsWith("/autoclose ") || + commandLine === "/clownfish autoclose" || + commandLine.startsWith("/clownfish autoclose "); + + if (!issue.pull_request && !isAutocloseCommand) { + core.info("Skipping non-autoclose command reaction because the comment is not on a pull request."); + return; + } + const maintainerPermissions = new Set(["admin", "maintain", "write"]); let permission = "none"; try { @@ -101,5 +107,5 @@ jobs: } await react("eyes"); - core.info(`Maintainer command observed on PR #${issue.number}: ${commandLine}`); + core.info(`Maintainer command observed on ${issue.pull_request ? "PR" : "issue"} #${issue.number}: ${commandLine}`); await react("+1");