Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(): add documenation on inherit_labels input #166

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ GitHub Cherry Pick Action will:
- Push new `branch` to remote
- Open pull request to `branch`

> *NOTE:* The `GITHUB_SHA` is taken from the GitHub context, specifically from the `merge_commit_sha` attribute of the pull request object.
> _NOTE:_ The `GITHUB_SHA` is taken from the GitHub context, specifically from the `merge_commit_sha` attribute of the pull request object.

## Example

Cherry-picking pull requests merged on main to branch *release-v1.0* in pull requests labeled with **release-v1.0** and to branch *release-v2.0* in pull requests labeled with **release-v2.0**.
Cherry-picking pull requests merged on main to branch _release-v1.0_ in pull requests labeled with **release-v1.0** and to branch _release-v2.0_ in pull requests labeled with **release-v2.0**.

```yml
on:
pull_request:
branches:
- main
types: ["closed"]
types: ['closed']

jobs:
cherry_pick_release_v1_0:
Expand Down Expand Up @@ -69,6 +69,7 @@ env:
```

### Using outputs:

```yml
steps:
- uses: actions/checkout@v3
Expand All @@ -79,16 +80,17 @@ steps:
labels: cherry-pick
- run: |
echo "${{ steps.new-issue.outputs.data }}"
echo "${{ steps.new-issue.outputs.number }}"
echo "${{ steps.new-issue.outputs.number }}"
echo "${{ steps.new-issue.outputs.html_url }}"
```

### Working with forked repositories

If you are using this action while working with forked repositories (e.g. when you get pull requests from external contributors), you will have to adapt the trigger to avoid permission problems.

In such a case you should use the `pull_request_target` trigger, which was introduced by github for this usecase.

### Example
### Example

```yml
on:
Expand All @@ -98,32 +100,34 @@ on:
types: ["closed"]
...
```

Mor informatoin can be found in the [GitHub Blog](https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/#improvements-for-public-repository-forks)

### Action inputs

| Name | Description | Default |
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| `token` | `GITHUB_TOKEN` or a `repo` scoped [Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). | `GITHUB_TOKEN` |
| `committer` | The committer name and email address in the format `Display Name <[email protected]>`. Defaults to the GitHub Actions bot user. | `GitHub <[email protected]>` |
| `author` | The author name and email address in the format `Display Name <[email protected]>`. Defaults to the user who triggered the workflow run. | `${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>` |
| `branch` | Name of the branch to merge the cherry pick. | `create-pull-request/patch` |
| `labels` | A comma or newline-separated list of labels. | |
| `assignees` | A comma or newline-separated list of assignees (GitHub usernames). | |
| `reviewers` | A comma or newline-separated list of reviewers (GitHub usernames) to request a review from. | |
| `team-reviewers` | A comma or newline-separated list of GitHub teams to request a review from. Note that a `repo` scoped [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) may be required. | |
| `title` | Title of the new pull request, the special string `{old_title}` will be substituted for the title of the pull request which triggered the action | [Triggering pull request title] |
| `body` | Body of the new pull request, the special string `{old_pull_request_id}` will be substituted for the ID of the pull request which triggered the action | [Triggering pull request body] |
| `cherry-pick-branch` | Name of the new cherry pick branch | `cherry-pick-${inputs.branch}-${commitSha}` |
| `force` | Set true or false to forcefully push the cherrypicked changes branch to remote branch. | false |
| Name | Description | Default |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `token` | `GITHUB_TOKEN` or a `repo` scoped [Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). | `GITHUB_TOKEN` |
| `committer` | The committer name and email address in the format `Display Name <[email protected]>`. Defaults to the GitHub Actions bot user. | `GitHub <[email protected]>` |
| `author` | The author name and email address in the format `Display Name <[email protected]>`. Defaults to the user who triggered the workflow run. | `${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>` |
| `branch` | Name of the branch to merge the cherry pick. | `create-pull-request/patch` |
| `inherit_labels` | Set true or false to inherit labels from the original pull request to the new cherry pick pull request. |
| `labels` | A comma or newline-separated list of labels. | |
| `assignees` | A comma or newline-separated list of assignees (GitHub usernames). | |
| `reviewers` | A comma or newline-separated list of reviewers (GitHub usernames) to request a review from. | |
| `team-reviewers` | A comma or newline-separated list of GitHub teams to request a review from. Note that a `repo` scoped [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) may be required. | |
| `title` | Title of the new pull request, the special string `{old_title}` will be substituted for the title of the pull request which triggered the action | [Triggering pull request title] |
| `body` | Body of the new pull request, the special string `{old_pull_request_id}` will be substituted for the ID of the pull request which triggered the action | [Triggering pull request body] |
| `cherry-pick-branch` | Name of the new cherry pick branch | `cherry-pick-${inputs.branch}-${commitSha}` |
| `force` | Set true or false to forcefully push the cherrypicked changes branch to remote branch. | false |

### Action outputs

| output | value |
|----------| ----- |
| output | value |
| -------- | ----------------------------------------------------------------------------- |
| data | [See Response](https://docs.github.com/en/rest/issues/issues#create-an-issue) |
| html_url | the issue's web url |
| number | the issue's number |
| html_url | the issue's web url |
| number | the issue's number |

## License

Expand Down