# My preview environment on GitHub is failing when trying to post a comment

**URL:** <https://community.okteto.com/t/my-preview-environment-on-github-is-failing-when-trying-to-post-a-comment/848>\
**Category:** Help\
**Created:** [June 2, 2023, 5:52pm UTC](https://community.okteto.com/t/my-preview-environment-on-github-is-failing-when-trying-to-post-a-comment/848 "2023-06-02T17:52:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramiro](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/ramiro/32/6_2.png) [@ramiro](https://community.okteto.com/u/ramiro)\
**Post date:** [June 2, 2023, 5:52pm UTC](https://community.okteto.com/t/my-preview-environment-on-github-is-failing-when-trying-to-post-a-comment/848/1 "2023-06-02T17:52:09Z")

</div>

I forked one of our examples, and when Okteto is deploying the preview environment, it is failing with this error:

```auto
/usr/local/bundle/gems/octokit-6.1.1/lib/octokit/response/raise_error.rb:14:in `on_complete': POST https://api.github.com/repos/rberrelleza/external-resources-tf-aws/issues/1/comments: 403 - Resource not accessible by integration // See: https://docs.github.com/rest/reference/issues#create-an-issue-comment (Octokit::Forbidden)
	from /usr/local/bundle/gems/faraday-2.7.5/lib/faraday/middleware.rb:18:in `block in call'
	from /usr/local/bundle/gems/faraday-2.7.5/lib/faraday/response.rb:42:in `on_complete'
	from /usr/local/bundle/gems/faraday-2.7.5/lib/faraday/middleware.rb:17:in `call'
	from /usr/local/bundle/gems/octokit-6.1.1/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection'
	from /usr/local/bundle/gems/octokit-6.1.1/lib/octokit/middleware/follow_redirects.rb:61:in `call'
	from /usr/local/bundle/gems/faraday-retry-2.2.0/lib/faraday/retry/middleware.rb:153:in `call'
	from /usr/local/bundle/gems/faraday-2.7.5/lib/faraday/rack_builder.rb:153:in `build_response'
	from /usr/local/bundle/gems/faraday-2.7.5/lib/faraday/connection.rb:444:in `run_request'
	from /usr/local/bundle/gems/faraday-2.7.5/lib/faraday/connection.rb:280:in `post'
	from /usr/local/bundle/gems/sawyer-0.9.2/lib/sawyer/agent.rb:99:in `call'
	from /usr/local/bundle/gems/octokit-6.1.1/lib/octokit/connection.rb:156:in `request'
	from /usr/local/bundle/gems/octokit-6.1.1/lib/octokit/connection.rb:28:in `post'
	from /usr/local/bundle/gems/octokit-6.1.1/lib/octokit/client/issues.rb:284:in `add_comment'
	from /notify-pr.sh:36:in `<main>'

```

This only happens when the repo is on my personal account, but not when it is under an organization.

---

<div class="post-metadata">

**Author:** ![nacho](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/nacho/32/20_2.png) [@nacho](https://community.okteto.com/u/nacho)\
**Post date:** [June 2, 2023, 6:14pm UTC](https://community.okteto.com/t/my-preview-environment-on-github-is-failing-when-trying-to-post-a-comment/848/2 "2023-06-02T18:14:02Z")

</div>

Hi @ramiro ,

Okteto’s GitHub action uses the secret `OKTETO_GITHUB` which is generated by GitHub on each workflow ([here](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret) you can find more information about it).

It might happen that the GitHub token generated in the action doesn’t have write permissions to post the comment. In this [GitHub help page](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#setting-the-permissions-of-the-github_token-for-your-repository) you can find how to check and change the permissions.

Summarizing, you can go to `Settings` in your GitHub repository, select `Actions -> General` and you should see a section called `Workflow permissions` which looks like this

 ![Captura de pantalla 2023-06-02 a las 20.11.31](https://us1.discourse-cdn.com/flex019/uploads/okteto/original/1X/2d1631ef7f7677e75cdbf3c9ef47101d230fb163.png)

You should set the option `Read and write permissions` to let the action to post a comment.

Hope this helps!
