Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Warning: Failed to set reaction on comment ID xx." #376

Open
clxmstaab opened this issue Jan 30, 2025 · 1 comment
Open

"Warning: Failed to set reaction on comment ID xx." #376

clxmstaab opened this issue Jan 30, 2025 · 1 comment

Comments

@clxmstaab
Copy link
Contributor

clxmstaab commented Jan 30, 2025

we get a error message after sending a comment with this workflow:

name: Chatops

on:
  issue_comment:
    types: [ created ]

jobs:
  slash-command-dispatch:
    runs-on: ubuntu-latest
    timeout-minutes: 1

    steps:
      - name: Slash Command Dispatch
        uses: peter-evans/slash-command-dispatch@v4
        with:
          token: ${{ secrets.PHP_GH_ACTION }}
          # reactions should be reported from github itself
          reaction-token: ${{ secrets.GITHUB_TOKEN }}
          commands: help, csfix, phpstan-baseline, deptrac-baseline, merge, ghostinspector, set-pr-description
          issue-type: pull-request

we warning the error "Warning: Failed to set reaction on comment ID xx." only for the /set-pr-description command.
the other chat commands in the same workflow work.

looking at the sources I can see only a single catch block which logs this warning

core.debug(utils.getErrorMessage(error))
core.warning(`Failed to set reaction on comment ID ${commentId}.`)

to ease debugging our problem it would be helpful to see the actual exception the octokit returns in this case.
is there a way to load the slash-command-dispatch action into our workflow with debug logging enabled?

edit: I just realized you are not yet on our sponsoring list. I have added you today as we rely on your actions in our workflows. thank you for that

@peter-evans
Copy link
Owner

Hi @clxmstaab

Is it a new repository where this workflow runs? I think for new repositories, this setting now defaults to read-only.

Image

If you find that is the case here, then what you should do is add a permissions block in your workflow to elevate the GITHUB_TOKEN permissions for just this workflow. That is better than changing the above setting to write.

e.g.

permissions:
  contents: write

I think just contents: write is enough for it to create reactions on comments, but I'm not 100% sure. It might also need issues: write and pull-requests: write (if the command is enabled for PRs).

And thank you so much for sponsoring me! Much appreciated. ❤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants