Apply suggestions from code review

Co-Authored-By: Peter Evans <peter-evans@users.noreply.github.com>
This commit is contained in:
Jérémy Derussé 2020-03-29 12:43:21 +02:00 committed by GitHub
parent 4c347a4514
commit 6bb0e7771c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View file

@ -56,7 +56,7 @@ With the exception of `token`, all inputs are **optional**. If not set, sensible
| `project` | The name of the project for which a card should be created. Requires `project-column`. | |
| `project-column` | The name of the project column under which a card should be created. Requires `project`. | |
| `branch` | The branch name. See [Branch naming](#branch-naming) for details. | `create-pull-request/patch` |
| `request-to-parent` | Whether or not the pull request should be create on the parent repository. | `false` |
| `request-to-parent` | Create the pull request in the parent repository of the checked out fork. | `false` |
| `base` | Sets the pull request base branch. | Defaults to the branch checked out in the workflow. |
| `branch-suffix` | The branch suffix type. Valid values are `random`, `timestamp` and `short-commit-hash`. See [Branch naming](#branch-naming) for details. | |

View file

@ -33,7 +33,7 @@ inputs:
branch:
description: 'The pull request branch name.'
request-to-parent:
description: 'Whether or not the pull request should be create on the parent repository.'
description: 'Create the pull request in the parent repository of the checked out fork.'
default: false
base:
description: 'The pull request base branch.'

View file

@ -67,7 +67,7 @@ def create_or_update_pull_request(
if request_to_parent:
github_repo = github_repo.parent
if github_repo is None:
raise ValueError("The repository is not a fork. The parameter request-to-parent should be set to false.")
raise ValueError("The checked out repository is not a fork. Input 'request-to-parent' should be set to false.")
head_branch = f"{head_repo.owner.login}:{branch}"

View file

@ -180,7 +180,7 @@ How to use SSH (deploy keys) with create-pull-request action:
token: ${{ secrets.GITHUB_TOKEN }}
```
### Push in fork
### Push pull request branches to a fork
To enforce security, you can use a dedicated user using [machine account](https://help.github.com/en/github/site-policy/github-terms-of-service#3-account-requirements).
This user has no access to the main repository, it will use their own fork to push code and create the pull request.
@ -190,7 +190,7 @@ This user has no access to the main repository, it will use their own fork to pu
3. create a [Personal Access Token (PAT)](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line).
4. logout and go back to your main user.
5. Add a secret to the repository containing the above PAT.
6. As show in the example below, switch the git remote to the fork's url after checkout and set the option `request-on-parent`
6. As shown in the example below, switch the git remote to the fork's url after checkout and set the action input `request-on-parent` to `true`.
```yaml
- uses: actions/checkout@v2