From 6bb0e7771c2913850f7809d560b0561a23f210f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Sun, 29 Mar 2020 12:43:21 +0200 Subject: [PATCH] Apply suggestions from code review Co-Authored-By: Peter Evans --- README.md | 2 +- action.yml | 2 +- dist/cpr/create_or_update_pull_request.py | 2 +- docs/concepts-guidelines.md | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b1c9d34..6711984 100644 --- a/README.md +++ b/README.md @@ -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. | | diff --git a/action.yml b/action.yml index 46ca140..ecbb65e 100644 --- a/action.yml +++ b/action.yml @@ -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.' diff --git a/dist/cpr/create_or_update_pull_request.py b/dist/cpr/create_or_update_pull_request.py index ab189ea..ed08b24 100644 --- a/dist/cpr/create_or_update_pull_request.py +++ b/dist/cpr/create_or_update_pull_request.py @@ -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}" diff --git a/docs/concepts-guidelines.md b/docs/concepts-guidelines.md index 29a1b61..3d0f035 100644 --- a/docs/concepts-guidelines.md +++ b/docs/concepts-guidelines.md @@ -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