Skip to content

Better documentation and error handling of missing permission to create PRs #557

@dreua

Description

@dreua

First of all thanks for the action! It worked well for me in my test-setup but after adding it to another repo it failed, that's why we're here:

I got these errors until I figured out that I needed to change the settings of my repository. It would have been nice to have a hint in the Readme (did I not see it?) and ideally directly in the error message hinting at what needs to be configured.

Run gr2m/create-or-update-pull-request-action@v1.x
Branch "create-or-update-pull-request-action" does not yet exist on remote.
Error: Command failed with exit code 128 (Unknown system error -128): git push -f ***github.com/dreua/flatpak-module-qpdf-pikepdf.git HEAD:refs/heads/create-or-update-pull-request-action
    at makeError (/home/runner/work/_actions/gr2m/create-or-update-pull-request-action/v1.x/dist/index.js:7699:11)
    at handlePromise (/home/runner/work/_actions/gr2m/create-or-update-pull-request-action/v1.x/dist/index.js:10615:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runShellCommand (/home/runner/work/_actions/gr2m/create-or-update-pull-request-action/v1.x/dist/index.js:997:32)
    at async main (/home/runner/work/_actions/gr2m/create-or-update-pull-request-action/v1.x/dist/index.js:758:5) {
  command: 'git push -f ***github.com/dreua/flatpak-module-qpdf-pikepdf.git HEAD:refs/heads/create-or-update-pull-request-action',
  exitCode: 128,
  exitCodeName: 'Unknown system error -128',
  stdout: '',
  stderr: 'remote: Permission to dreua/flatpak-module-qpdf-pikepdf.git denied to github-actions[bot].\n' +
    "fatal: unable to access 'https://github.com/dreua/flatpak-module-qpdf-pikepdf.git/': The requested URL returned error: 403",
  all: 'remote: Permission to dreua/flatpak-module-qpdf-pikepdf.git denied to github-actions[bot].\n' +
    "fatal: unable to access 'https://github.com/dreua/flatpak-module-qpdf-pikepdf.git/': The requested URL returned error: 403",
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  signal: undefined

Note that the tick in "Allow GitHub Actions to create and approve pull requests" is not sufficient, you need the "Read and write permissions" setting. Whether the checkbox needs to be ticket at all needs to be tested, I'm just happy that it works now.

Screenshot from 2023-07-14 19-37-49

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions