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

help needed: 404 when creating PR using GITHUB_TOKEN #440

Closed
flavianmissi opened this issue Jan 21, 2022 · 4 comments
Closed

help needed: 404 when creating PR using GITHUB_TOKEN #440

flavianmissi opened this issue Jan 21, 2022 · 4 comments
Labels
Type: Support Any questions, information, or general needs around the SDK or GitHub APIs

Comments

@flavianmissi
Copy link

What happened?

I'm trying to create a pull request from a Github action and I'm getting a 404.
This is the action in question, and here is the relevant code.

The latest workflow run is using the GITHUB_TOKEN to authorise with the API.

Here's the relevant code snippet:

// config.token comes from the action yaml, defaults to github.token
let octokit = new Octokit({auth: config.token})
const response = await octokit.request(`POST /repos/${owner}/${repo}/pulls`, {
  owner: owner,
  repo: repo,
  head: branchname,
  base: base,
}).catch(console.log)

What did you expect to happen?

I expected octokit to be able to create the PR instead of the 404. Github API docs state that the token should have read/write permission by default for the permissive setting (which my repo is using). Additionally, in the "Set up job" section of the workflow job I see PullRequests: write.

What the problem might be

My suspicion is that this is a permission related problem, but as previously stated I'm using the GITHUB_TOKEN which as far as I understand should be able to create a PR. I'm probably missing something.

Thanks in advance!

@flavianmissi flavianmissi added the Type: Bug Something isn't working as documented label Jan 21, 2022
@flavianmissi flavianmissi changed the title help needed: 404 when creating PR with GITHUB_TOKEN help needed: 404 when creating PR using GITHUB_TOKEN Jan 21, 2022
@octokit octokit deleted a comment from lone96fr Feb 5, 2022
@octokit octokit deleted a comment Mar 9, 2022
@octokit octokit deleted a comment from JiriZi Mar 25, 2022
@octokit octokit deleted a comment from Mohm730 Mar 25, 2022
@gr2m
Copy link
Contributor

gr2m commented Mar 25, 2022

Does the problem persist? Looks like you changed your code since you filed the issue?

@gr2m gr2m closed this as completed Mar 25, 2022
@gr2m gr2m added Type: Support Any questions, information, or general needs around the SDK or GitHub APIs and removed Type: Bug Something isn't working as documented labels Mar 25, 2022
@flavianmissi
Copy link
Author

Hi @gr2m, I didn't change my code - not sure what that notification was about.
So yeah the problem persists :/

@gr2m gr2m reopened this Mar 28, 2022
@gr2m
Copy link
Contributor

gr2m commented Mar 28, 2022

I don't know what the problem could be, but I think it's unlikely an Octokit problem

@flavianmissi
Copy link
Author

yeah you're probably right @gr2m, if you can't see anything obviously wrong the code I'd be okay with closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Support Any questions, information, or general needs around the SDK or GitHub APIs
Projects
None yet
Development

No branches or pull requests

3 participants
@gr2m @flavianmissi and others