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

Fix website regen #142

Merged
merged 4 commits into from
Feb 26, 2024
Merged

Fix website regen #142

merged 4 commits into from
Feb 26, 2024

Conversation

JavierMatosD
Copy link
Collaborator

The workflow is failing. Here's what was printed:

RequestError [HttpError]: Validation Failed: {"resource":"PullRequest","code":"custom","field":"fork_collab","message":"fork_collab Fork collab can't be granted by someone without permission"}
    at /home/runner/work/_actions/actions/github-script/v6/dist/index.js:6842:21
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async eval (eval at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:15143:16), <anonymous>:17:1)
    at async main (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:15236:20) {
  status: 422,
  response: {
    url: 'https://api.github.com/repos/vcpkg/vcpkg.github.io/pulls',
    status: 422,
    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-length': '275',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Mon, 19 Feb 2024 05:10:36 GMT',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      server: 'GitHub.com',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      vary: 'Accept-Encoding, Accept, X-Requested-With',
      'x-accepted-github-permissions': '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': '0470:156380:151F6F5:2A95C07:65D2E2CB',
      'x-ratelimit-limit': '1000',
      'x-ratelimit-remaining': '999',
      'x-ratelimit-reset': '1708323036',
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '1',
      'x-xss-protection': '0'
    },
    data: {
      message: 'Validation Failed',
      errors: [Array],
      documentation_url: 'https://docs.github.com/rest/pulls/pulls#create-a-pull-request'
    }
  },
  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/vcpkg/vcpkg.github.io/pulls',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'actions/github-script octokit-core.js/3.6.0 Node.js/16.20.2 (linux; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"title":"Update Package Metadata - 2024-02-19T05:10:35.769Z","body":"This PR was automatically created by a GitHub Action triggered by a schedule. It updates the package metadata and website content.","head":"JavierMatosD:package_sync","base":"main"}',
    request: { agent: [Agent], hook: [Function: bound bound register] }
  }
}
Error: Unhandled error: HttpError: Validation Failed: {"resource":"PullRequest","code":"custom","field":"fork_collab","message":"fork_collab Fork collab can't be granted by someone without permission"}

Interestingly,

 body: '{"title":"Update Package Metadata - 2024-02-19T05:10:35.769Z",
"body":"This PR was automatically created by a GitHub Action triggered by a schedule. 
It updates the package metadata and website content.","head":"JavierMatosD:package_sync","base":"main"}',
    request: { agent: [Agent], hook: [Function: bound bound register] }
  }

Seems to be trying to create the pull request from my fork instead.

I'm not entirely sure this will fix the problem, but in the Open Pull Request step, the script specifies the head parameter as ${actor}:${newBranch}. If the package_sync branch is already in the main repository, you don't need to prefix it with the actor. Instead, you can directly reference the branch name.

I modified the head parameter in the Open Pull Request step to simply use newBranch without prefixing it with the actor, like so: head: newBranch,.

I'm hoping this ensure the action attempts to create a pull request using the package_sync branch from within the main repository itself, rather than looking for it in a fork.

@JavierMatosD
Copy link
Collaborator Author

Looking for ideas for testing this (or anything I may have missed). I've tested the workflow on my fork and it works fine (creates the PR), but given the nature of the error that's not sufficient.

@JavierMatosD JavierMatosD merged commit a385e46 into vcpkg:main Feb 26, 2024
1 check passed
@JavierMatosD JavierMatosD deleted the fix_website_regen branch June 20, 2024 17:58
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

Successfully merging this pull request may close these issues.

2 participants