|
4 | 4 | [](https://github.com/ambv/black)
|
5 | 5 |
|
6 | 6 | # Pull request description generator
|
7 |
| -A GitHub action and command-line tool that generates pull request descriptions from Conventional Commit messages on a |
8 |
| -branch. These descriptions can be used with other GitHub actions to automate release notes. |
| 7 | +A GitHub action that generates pull request descriptions from |
| 8 | +[Conventional Commit messages](https://www.conventionalcommits.org/en/v1.0.0/) on a branch. These descriptions can be |
| 9 | +used with other GitHub actions to automate release notes. |
9 | 10 |
|
10 |
| -**Features** |
| 11 | +**Features summary** |
11 | 12 | - Automatic breaking change highlighting and upgrade instructions
|
12 | 13 | - Automatic categorisation of all commit messages in the pull request branch
|
13 | 14 | - Choosing which part of the description to generate, enabling descriptions containing a generated section alongside
|
14 |
| - static/developer-written sections |
| 15 | + static/user-written sections |
15 | 16 | - Easy skipping of description updating when you're ready to fine-tune and edit the description
|
16 | 17 |
|
17 |
| -## GitHub action |
18 |
| -The generator can easily be used as a step in a GitHub workflow alongside the |
19 |
| -[`riskledger/update-pr-description`](https://github.com/riskledger/update-pr-description) action: |
| 18 | +## Usage |
| 19 | +Add the action to pull request workflows alongside the |
| 20 | +[`riskledger/update-pr-description`](https://github.com/riskledger/update-pr-description) action to dynamically update |
| 21 | +the description each time you push: |
20 | 22 |
|
21 | 23 | ```yaml
|
22 | 24 | steps:
|
23 | 25 | - uses: actions/checkout@v3
|
24 | 26 |
|
25 |
| - |
| 27 | + |
| 28 | + id: pr-description |
26 | 29 | with:
|
27 | 30 | pull_request_url: ${{ github.event.pull_request.url }}
|
28 | 31 | api_token: ${{ secrets.GITHUB_TOKEN }}
|
29 | 32 |
|
30 | 33 | - name: Update pull request body
|
31 | 34 | uses: riskledger/update-pr-description@v2
|
32 | 35 | with:
|
33 |
| - body: ${{ env.PULL_REQUEST_DESCRIPTION }} |
| 36 | + body: ${{ steps.pr-description.outputs.pull_request_description }} |
34 | 37 | token: ${{ secrets.GITHUB_TOKEN }}
|
35 | 38 | ```
|
36 | 39 |
|
37 |
| -The generated description is available from the environment variable `PULL_REQUEST_DESCRIPTION` instead of as an output |
38 |
| -of the action (`::set-output...` only works with single-line outputs). It's accessible from |
39 |
| -`${{ env.PULL_REQUEST_DESCRIPTION }}` at any point in the workflow job it was used in. |
40 |
| - |
41 |
| -## CLI |
42 |
| -```shell |
43 |
| -usage: generate-pull-request-description [-h] [--pull-request-url PULL_REQUEST_URL] [--api-token API_TOKEN] [--header HEADER] [--list-item-symbol LIST_ITEM_SYMBOL] [--no-link-to-pull-request] {LAST_RELEASE,PULL_REQUEST_START} |
44 |
| -
|
45 |
| -positional arguments: |
46 |
| - {LAST_RELEASE,PULL_REQUEST_START} |
47 |
| - The point in the git history to stop compiling commits into the pull request description. |
48 |
| -
|
49 |
| -options: |
50 |
| - -h, --help show this help message and exit |
51 |
| - --pull-request-url PULL_REQUEST_URL |
52 |
| - Provide the API URL of a pull request (e.g. https://api.github.com/repos/octue/conventional-commits/pulls/1) if you want to update a pull request's description with the generated release notes. It must be |
53 |
| - provided alongside --api-token if the repository is private. |
54 |
| - --api-token API_TOKEN |
55 |
| - A valid GitHub API token for the repository the pull request belongs to. There is no need to provide this if the repository is public. |
56 |
| - --header HEADER The header (including MarkDown styling) to put the release notes under. Default is '# Contents' |
57 |
| - --list-item-symbol LIST_ITEM_SYMBOL |
58 |
| - The MarkDown list item symbol to use for listing commit messages in the release notes. Default is '- ' |
59 |
| - --no-link-to-pull-request |
60 |
| - If provided, don't add a link to the given pull request in the release notes. |
61 |
| -
|
62 |
| -``` |
63 |
| - |
64 | 40 | ## Features
|
65 | 41 |
|
66 | 42 | ### Breaking change highlighting
|
|
0 commit comments