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

"Create a new PR" doesn't target the correct specified GitHub repo #1575

Open
beafialho opened this issue Jul 5, 2024 · 3 comments
Open

Comments

@beafialho
Copy link

When I create a new PR to add a new theme to the repo, I would expect it to end up on https://github.com/Automattic/themes/, but the PR is opened from a fork of this repo https://github.com/beafialho/themes instead.

More context

Captura de ecrã 2024-07-05, às 09 20 44

@brandonpayton
Copy link
Member

Based on permissions, it looks like this should be working for @beafialho, but perhaps we are encountering an error and pushing to a fork as a fallback here:

if (
e.status === 403 &&
e.message?.includes(
'organization has enabled OAuth App access restrictions'
) &&
!shouldFork
) {
return await pushToGithub(octokit, {
...options,
shouldFork: true,

@adamziel
Copy link
Collaborator

adamziel commented Jul 16, 2024

GitHub permissions are weird. Sometimes you are a repo admin, but the organization restricted what you can do via different types of auth tokens – like the OAuth token we use here. Assuming organization restrictions are the problem here, here's what would help:

  • A clear feedback for the user whenever we encounter a permissions issue and need to fall back to a fork
  • A way to provide a personal access token that doesn't have the same restrictions
@adamziel
Copy link
Collaborator

adamziel commented Jul 16, 2024

Since this issue is a blocker for GitHub automations leaving comments with PR preview links in the Automattic/themes repo (since the pull_request: trigger won't run for forks), I left this comment and added the other issue to the board:

@mikachan would there be anything wrong with using the pull_request_target: trigger instead of pull_request: in the preview-theme.yml workflow? This would make it work for PRs from forks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants