Apply suggestions from code review
Co-Authored-By: Peter Evans <peter-evans@users.noreply.github.com>
This commit is contained in:
parent
4c347a4514
commit
6bb0e7771c
4 changed files with 5 additions and 5 deletions
|
@ -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` | 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`. | |
|
| `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` |
|
| `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. |
|
| `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. | |
|
| `branch-suffix` | The branch suffix type. Valid values are `random`, `timestamp` and `short-commit-hash`. See [Branch naming](#branch-naming) for details. | |
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ inputs:
|
||||||
branch:
|
branch:
|
||||||
description: 'The pull request branch name.'
|
description: 'The pull request branch name.'
|
||||||
request-to-parent:
|
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
|
default: false
|
||||||
base:
|
base:
|
||||||
description: 'The pull request base branch.'
|
description: 'The pull request base branch.'
|
||||||
|
|
2
dist/cpr/create_or_update_pull_request.py
vendored
2
dist/cpr/create_or_update_pull_request.py
vendored
|
@ -67,7 +67,7 @@ def create_or_update_pull_request(
|
||||||
if request_to_parent:
|
if request_to_parent:
|
||||||
github_repo = github_repo.parent
|
github_repo = github_repo.parent
|
||||||
if github_repo is None:
|
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}"
|
head_branch = f"{head_repo.owner.login}:{branch}"
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ How to use SSH (deploy keys) with create-pull-request action:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
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).
|
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.
|
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).
|
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.
|
4. logout and go back to your main user.
|
||||||
5. Add a secret to the repository containing the above PAT.
|
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
|
```yaml
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
Loading…
Reference in a new issue