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

There is an issues related to permission occurred #238

Closed
abhi6774 opened this issue Aug 7, 2023 · 4 comments
Closed

There is an issues related to permission occurred #238

abhi6774 opened this issue Aug 7, 2023 · 4 comments

Comments

@abhi6774
Copy link

abhi6774 commented Aug 7, 2023

Run peter-evans/create-or-update-comment@v3
with:
issue-number: 5
body: This is a multi-line test comment

reactions: +1
token: ***
repository: glxymesh/track
edit-mode: append
append-separator: newline
reactions-edit-mode: append

/home/runner/work/_actions/peter-evans/create-or-update-comment/v3/dist/index.js:4694
const error = new requestError.RequestError(toErrorMessage(data), status, {
^

RequestError [HttpError]: Resource not accessible by integration
at /home/runner/work/_actions/peter-evans/create-or-update-comment/v3/dist/index.js:4694:21
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
status: 403,
response: {
url: 'https://api.github.com/repos/glxymesh/track/issues/5/comments',
status: 403,
headers: {
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
connection: 'close',
'content-encoding': 'gzip',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Mon, 07 Aug 2023 06:18:53 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'transfer-encoding': 'chunked',
vary: 'Accept-Encoding, Accept, X-Requested-With',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-api-version-selected': '2022-11-28',
'x-github-media-type': 'github.v3; format=json',
'x-github-request-id': '6109:0CE9:17A4203:303D8D7:64D08CCD',
'x-ratelimit-limit': '1000',
'x-ratelimit-remaining': '996',
'x-ratelimit-reset': '1691391950',
'x-ratelimit-resource': 'core',
'x-ratelimit-used': '4',
'x-xss-protection': '0'
},
data: {
message: 'Resource not accessible by integration',
documentation_url: 'https://docs.github.com/rest/issues/comments#create-an-issue-comment'
}
},
request: {
method: 'POST',
url: 'https://api.github.com/repos/glxymesh/track/issues/5/comments',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit-core.js/3.6.0 Node.js/16.16.0 (linux; x64)',
authorization: 'token [REDACTED]',
'content-type': 'application/json; charset=utf-8'
},
body: '{"body":"This is a multi-line test comment\n- With GitHub Markdown ✨\n- Created by create-or-update-comment\n\n1: https://github.com/peter-evans/create-or-update-comment"}',
request: {
agent: Agent {
_events: [Object: null prototype] {
free: [Function (anonymous)],
newListener: [Function: maybeEnableKeylog]
},
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object: null prototype] { path: null },
requests: [Object: null prototype] {},
sockets: [Object: null prototype] {},
freeSockets: [Object: null prototype] {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 0,
maxCachedSessions: 100,
_sessionCache: {
map: {
'api.github.com:443:::::::::::::::::::::': [Buffer [Uint8Array]]
},
list: [ 'api.github.com:443:::::::::::::::::::::' ]
},
[Symbol(kCapture)]: false
},
hook: [Function: bound bound register]
}
}
}

@spilliams
Copy link

I resolved this by adding the following to my job:

jobs:
  prepare-pr-comment:
    permissions:
      pull-requests: write
    ...

@rharkor
Copy link

rharkor commented Aug 9, 2023

Still have the problem

@peter-evans
Copy link
Owner

There is a note in the readme about this error here:
https://github.com/peter-evans/create-or-update-comment#action-inputs

Note: In public repositories this action does not work in pull_request workflows when triggered by forks. Any attempt will be met with the error, Resource not accessible by integration. This is due to token restrictions put in place by GitHub Actions. Private repositories can be configured to enable workflows from forks to run without restriction. See here for further explanation. Alternatively, use the pull_request_target event to comment on pull requests.

@abhi6774
Copy link
Author

The issue is resolved by converting the repository from private to public.

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

4 participants