pull-request
pull-request copied to clipboard
Completing successfully even with failure on hub remote request.
When using github job specific permissions and not allowing pr writes, this action should error.
I believe the issue is here: https://github.com/repo-sync/pull-request/blob/master/entrypoint.sh#L84
Using || true will allow this command to succeed even during failure?
To recreate:
-
Make default action permission in repo = read-only
Settings -> Actions -> Workflow permissions -> Read repository contents permission -
Run action with repo-sync/pull-request No PR created, but action succeeds with message like
hub pull-request -b master -h branchybranchy --no-edit -m "some message" || true
Error creating pull request: Forbidden (HTTP 403)
Resource not accessible by integration
- Add permission to write pr's into action.yaml
jobs:
create-pr:
name: "create some PR"
permissions:
pull-requests: write
...
- Run action again, with successful pr creation.
hub pull-request -b master -h branchybranchy --no-edit -m "some message" || true
https://github.com/loosebazooka/testtest/pull/16
Thanks for the detailed issue. We didn't want to error when prs failed to be created because you could have permission but there just weren't any changes between the branches. We're open to adding an optional input fail_on_error or similar that does what you described. PR Welcome~
For my own understanding, what do you mean by:
We didn't want to error when prs failed to be created because you could have permission but there just weren't any changes between the branches.
I'm not sure I understand when this use-case will arise?
In the meantime, I'm trying to see if I can get exit codes or structured error output in hub.
The action let's you define source and destination branches. There are cases when someone might run this on a schedule and ignore errors when a pr can't be created due to lack of changes.
Thank you for opening this issue. Per the updated README, we are in process of archiving this repository, and encourage using gh pr create directly in your workflows instead.