WordPress / community-themes

A collection of Block Themes built by the WordPress community.
70 stars 26 forks source link

Playground link workflow fails on forked PRs #188

Open MaggieCabrera opened 1 month ago

MaggieCabrera commented 1 month ago

If a user without permissions in the repo submits a PR via a fork, the action always failed with an error such as:

Run actions/github-script@v7
RequestError [HttpError]: Resource not accessible by integration
    at /home/runner/work/_actions/actions/github-script/v7/dist/index.js:9537:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  status: 403,
  response: {
    url: 'https://api.github.com/repos/WordPress/community-themes/issues/179/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',
      'content-encoding': 'gzip',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Fri, 17 May 2024 13:59:25 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-accepted-github-permissions': 'issues=write; pull_requests=write',
      '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': 'FCB2:182D:36FF1C1:5E61A43:664762BD',
      'x-ratelimit-limit': '15000',
      'x-ratelimit-remaining': '14998',
      'x-ratelimit-reset': '1715957965',
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '2',
      '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/WordPress/community-themes/issues/179/comments',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'actions/github-script octokit-core.js/5.0.1 Node.js/20.8.1 (linux; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: `{"body":"### Preview changes\\n\\nI've detected changes to the following themes in this PR: Poetry.\\n\\nYou can preview these changes by following the links below:\\n\\n- [Preview changes for **Poetry**](https://playground.wordpress.net/#{\\"steps\\":[{\\"step\\":\\"login\\",\\"username\\":\\"admin\\",\\"password\\":\\"password\\"},{\\"step\\":\\"installTheme\\",\\"themeZipFile\\":{\\"resource\\":\\"url\\",\\"url\\":\\"https://github-proxy.com/proxy.php?action=partial&repo=Wordpress/community-themes&directory=poetry&branch=add/poetry-header-small\\"}},{\\"step\\":\\"activateTheme\\",\\"themeFolderName\\":\\"poetry\\"}]})\\n\\nI will update this comment with the latest preview links as you push more changes to this PR.\\n\\n**⚠️ Note:** The preview sites are created using [WordPress Playground](https://wordpress.org/playground/). You can add content, edit settings, and test the themes as you would on a real site, but please note that changes are not saved between sessions.\\n\\n"}`,
    request: {
      agent: [Agent],
      fetch: [Function: proxyFetch],
      hook: [Function: bound bound register]
    }
  }
}
Error: Unhandled error: HttpError: Resource not accessible by integration