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

danger Action fails on POST #1462

Open
jaymzh opened this issue Oct 3, 2023 · 6 comments
Open

danger Action fails on POST #1462

jaymzh opened this issue Oct 3, 2023 · 6 comments

Comments

@jaymzh
Copy link

jaymzh commented Oct 3, 2023

Report

What did you do?

Use the GH action thusly:

  danger:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - uses: actions/checkout@v2
      - uses: danger/danger@master
        env:
          DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

What did you expect to happen?

It to work.

Note that if I do a "bundle exec danger" instead, it logs the problems to the log (but cannot write a comment to the PR), which is not optimal, but at least is useful. With the Action it just fails to run.

What happened instead?

bundler: failed to load command: danger (/usr/local/bundle/bin/danger)
/usr/local/bundle/gems/octokit-7.2.0/lib/octokit/response/raise_error.rb:14:in `on_complete': POST https://api.github.com/repos/chef/chef/issues/13976/comments: 403 - Resource not accessible by integration // See: https://docs.github.com/rest/issues/comments#create-an-issue-comment (Octokit::Forbidden)

Your Environment

  • Which CI are you running on? GH Actions
  • Are you running the latest version of Danger? Yes
  • What is your Dangerfile?
# Enforce our Gemfile update policy
if git.modified_files.include?('Gemfile.lock')
  if git.modified_files.include?('Gemfile')
    message "PR updates Gemfile.lock, but it also updates Gemfile, so that" +
      " is probably OK - but the reviewer should check updates are soley" +
      " from the Gemfile update"
  elsif !github.pr_body.include?('--conservative')
    if github.pr_body.include?("#gemlock_major_upgrade")
      message "PR updates Gemfile.lock, but output doesn't appear to be in" +
          " the PR Description. However #gemlock_major_upgrade does, so allowing"
    else
      failure "Gem/Bundle changes were not documented in the Description. If" +
        " this is a major update, add #gemlock_major_upgrade to the PR"
        " Description."
    end
  end
end
@orta
Copy link
Member

orta commented Oct 4, 2023

Hey there, I don't think we support Danger being used as an action ( https://github.com/marketplace?category=&type=actions&verification=&query=danger ) maybe it's github guessing what to do and getting it wrong?

I know there are some people using docker, but I have no idea how all that works

@jaymzh
Copy link
Author

jaymzh commented Oct 4, 2023

Uh, what? Your code and your docs disagree with you:

The danger.system website says your support is and pulls from there for the how to.

@andrelaszlo
Copy link

Are you using bundler-cache: true in your workflow? Try "clearing" the cache by setting/incrementing cache-version. See setup-ruby: Dealing with a corrupted cache.

@jaymzh
Copy link
Author

jaymzh commented Oct 15, 2023

No, we are not (well, we don't specify, and my understanding is the default is false)

@andrelaszlo
Copy link

Ok! Got the same error and the above fix worked - perhaps it could give a clue anyway.

@jaymzh
Copy link
Author

jaymzh commented Oct 17, 2023

... there's no setup-ruby step required when using the built-in Action, it handles that itself. As I said, see:

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

3 participants