danger / danger/danger

Danger is not able to comment on PR

Open
#1,525 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
5.7k
Forks
488
PR merge metrics
No merged PRs in 30d

Description

I have validated that it works with my PAT but doesn't work with the default GitHub actions token

This is my config file:

```yml
name: Danger Checks

on:
pull_request:

permissions:
pull-requests: write # allow Danger to comment on PRs
contents: read # needed to fetch repo code

jobs:
danger:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set Up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4

- name: Danger Checks
run: |
gem install bundler
bundle install
bundle exec danger --verbose

env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

It fails with the following stacktrace
Details

opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/octokit-10.0.0/lib/octokit/response/raise_error.rb:14:in 'Octokit::Response::RaiseError#on_complete': GET https://api.github.com/repos/org/repo/issues/1057: 403 - Resource not accessible by integration // See: https://docs.github.com/rest/issues/issues#get-an-issue (Octokit::Forbidden)
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/faraday-2.13.4/lib/faraday/middleware.rb:57:in 'block in Faraday::Middleware#call'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/faraday-2.13.4/lib/faraday/response.rb:42:in 'Faraday::Response#on_complete'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/faraday-2.13.4/lib/faraday/middleware.rb:56:in 'Faraday::Middleware#call'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/octokit-10.0.0/lib/octokit/middleware/follow_redirects.rb:73:in 'Octokit::Middleware::FollowRedirects#perform_with_redirection'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/octokit-10.0.0/lib/octokit/middleware/follow_redirects.rb:61:in 'Octokit::Middleware::FollowRedirects#call'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/faraday-2.13.4/lib/faraday/rack_builder.rb:153:in 'Faraday::RackBuilder#build_response'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/faraday-2.13.4/lib/faraday/connection.rb:452:in 'Faraday::Connection#run_request'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/faraday-2.13.4/lib/faraday/connection.rb:200:in 'Faraday::Connection#get'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/sawyer-0.9.2/lib/sawyer/agent.rb:99:in 'Sawyer::Agent#call'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/octokit-10.0.0/lib/octokit/connection.rb:158:in 'Octokit::Connection#request'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/octokit-10.0.0/lib/octokit/connection.rb:19:in 'Octokit::Connection#get'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/danger-9.5.3/lib/danger/request_sources/github/github.rb:149:in 'Danger::RequestSources::GitHub#fetch_issue_details'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/danger-9.5.3/lib/danger/request_sources/github/github.rb:139:in 'Danger::RequestSources::GitHub#fetch_details'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/danger-9.5.3/lib/danger/danger_core/environment_manager.rb:55:in 'Danger::EnvironmentManager#fill_environment_vars'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/danger-9.5.3/lib/danger/danger_core/dangerfile.rb:280:in 'Danger::Dangerfile#run'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/danger-9.5.3/lib/danger/danger_core/executor.rb:28:in 'Danger::Executor#run'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/danger-9.5.3/lib/danger/commands/runner.rb:73:in 'Danger::Runner#run'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/claide-1.1.0/lib/claide/command.rb:334:in 'CLAide::Command.run'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/danger-9.5.3/bin/danger:5:in ''
from /opt/hostedtoolcache/Ruby/3.4.5/x64/bin/danger:25:in 'Kernel#load'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/bin/danger:25:in ''
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/lib/bundler/cli/exec.rb:59:in 'Kernel.load'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/lib/bundler/cli/exec.rb:59:in 'Bundler::CLI::Exec#kernel_load'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/lib/bundler/cli/exec.rb:23:in 'Bundler::CLI::Exec#run'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/lib/bundler/cli.rb:451:in 'Bundler::CLI#exec'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/lib/bundler/vendor/thor/lib/thor/command.rb:28:in 'Bundler::Thor::Command#run'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in 'Bundler::Thor::Invocation#invoke_command'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/lib/bundler/vendor/thor/lib/thor.rb:538:in 'Bundler::Thor.dispatch'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/lib/bundler/cli.rb:35:in 'Bundler::CLI.dispatch'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/lib/bundler/vendor/thor/lib/thor/base.rb:584:in 'Bundler::Thor::Base::ClassMethods#start'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/lib/bundler/cli.rb:29:in 'Bundler::CLI.start'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/exe/bundle:28:in 'block in '
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/lib/bundler/friendly_errors.rb:118:in 'Bundler.with_friendly_errors'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/lib/ruby/gems/3.4.0/gems/bundler-2.7.1/exe/bundle:20:in ''
from /opt/hostedtoolcache/Ruby/3.4.5/x64/bin/bundle:25:in 'Kernel#load'
from /opt/hostedtoolcache/Ruby/3.4.5/x64/bin/bundle:25:in '

'


Contributor guide

No contributing guide indexed for this repository

Research direction

Start in danger/request_sources/github/github.rb at fetch_issue_details, then reproduce the shown GitHub Actions workflow with the default token and the reported permissions. Compare the failing issue lookup with the successful PAT case; done means Danger can fetch the pull request details and post its comment using the default token, with coverage for the behavior if an existing test location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, github-actions, ruby
Domain
api, ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.