2020-02-27 18:32:31 +01:00
|
|
|
<p align="center">
|
|
|
|
<a href="http://codely.tv">
|
2021-03-04 11:57:35 +01:00
|
|
|
<img alt="CodelyTV logo" src="http://codely.tv/wp-content/uploads/2016/05/cropped-logo-codelyTV.png" width="192px" height="192px"/>
|
2020-02-27 18:32:31 +01:00
|
|
|
</a>
|
|
|
|
</p>
|
2020-02-27 17:08:37 +01:00
|
|
|
|
2020-02-27 18:32:31 +01:00
|
|
|
<h1 align="center">
|
2024-04-15 06:10:19 -07:00
|
|
|
🏷 Pull Request Size Labeler
|
2020-02-27 18:32:31 +01:00
|
|
|
</h1>
|
|
|
|
|
|
|
|
<p align="center">
|
|
|
|
<a href="https://github.com/CodelyTV"><img src="https://img.shields.io/badge/CodelyTV-OS-green.svg?style=flat-square" alt="codely.tv"/></a>
|
|
|
|
<a href="http://pro.codely.tv"><img src="https://img.shields.io/badge/CodelyTV-PRO-black.svg?style=flat-square" alt="CodelyTV Courses"/></a>
|
2020-03-02 08:59:03 +01:00
|
|
|
<a href="https://github.com/marketplace/actions/pull-request-size-labeler"><img src="https://img.shields.io/github/v/release/CodelyTV/pr-size-labeler?style=flat-square" alt="GitHub Action version"></a>
|
2020-02-27 18:32:31 +01:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<p align="center">
|
|
|
|
Visualize and optionally limit the size of your Pull Requests
|
|
|
|
</p>
|
|
|
|
|
|
|
|
## 🚀 Usage
|
|
|
|
|
2024-04-15 06:10:19 -07:00
|
|
|
Create a file named `labeler.yml` inside the `.github/workflows` directory and paste the following configuration:
|
2020-02-27 18:32:31 +01:00
|
|
|
|
|
|
|
```yml
|
|
|
|
name: labeler
|
|
|
|
|
|
|
|
on: [pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
labeler:
|
|
|
|
runs-on: ubuntu-latest
|
2020-02-27 18:48:35 +01:00
|
|
|
name: Label the PR size
|
2020-02-27 18:32:31 +01:00
|
|
|
steps:
|
|
|
|
- uses: codelytv/pr-size-labeler@v1
|
|
|
|
with:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-09-20 05:30:23 -04:00
|
|
|
xs_label: 'size/xs'
|
2020-03-04 14:21:23 +01:00
|
|
|
xs_max_size: '10'
|
2021-09-20 05:30:23 -04:00
|
|
|
s_label: 'size/s'
|
2020-02-27 18:32:31 +01:00
|
|
|
s_max_size: '100'
|
2021-09-20 05:30:23 -04:00
|
|
|
m_label: 'size/m'
|
2020-03-04 14:21:23 +01:00
|
|
|
m_max_size: '500'
|
2021-09-20 05:30:23 -04:00
|
|
|
l_label: 'size/l'
|
2020-03-04 14:21:23 +01:00
|
|
|
l_max_size: '1000'
|
2021-09-20 05:30:23 -04:00
|
|
|
xl_label: 'size/xl'
|
2020-03-04 14:21:23 +01:00
|
|
|
fail_if_xl: 'false'
|
2021-03-04 11:55:50 +01:00
|
|
|
message_if_xl: >
|
2022-04-07 21:38:33 +02:00
|
|
|
This PR exceeds the recommended size of 1000 lines.
|
2021-03-04 11:55:50 +01:00
|
|
|
Please make sure you are NOT addressing multiple issues with one PR.
|
2022-04-07 21:38:33 +02:00
|
|
|
Note this PR might be rejected due to its size.
|
2024-04-15 16:20:40 +09:00
|
|
|
github_api_url: 'https://api.github.com'
|
2022-03-20 11:32:33 +01:00
|
|
|
files_to_ignore: ''
|
2020-02-27 17:08:37 +01:00
|
|
|
```
|
2020-02-27 18:32:31 +01:00
|
|
|
|
2024-04-15 06:10:19 -07:00
|
|
|
## 🎛️ Arguments
|
|
|
|
|
|
|
|
| Name | Required | Default Value | Description |
|
|
|
|
|-------------------|----------|----------------------|-------------------------------------------------------------------------------------------------------------------------|
|
|
|
|
| `GITHUB_TOKEN` | Yes | Automatically supplied| GitHub token needed to interact with the repository. |
|
|
|
|
| `xs_label` | No | 'size/xs' | Label for very small-sized PRs. |
|
|
|
|
| `xs_max_size` | No | '10' | Maximum number of changes allowed for XS-sized PRs. |
|
|
|
|
| `s_label` | No | 'size/s' | Label for small-sized PRs. |
|
|
|
|
| `s_max_size` | No | '100' | Maximum number of changes allowed for S-sized PRs. |
|
|
|
|
| `m_label` | No | 'size/m' | Label for medium-sized PRs. |
|
|
|
|
| `m_max_size` | No | '500' | Maximum number of changes allowed for M-sized PRs. |
|
|
|
|
| `l_label` | No | 'size/l' | Label for large-sized PRs. |
|
|
|
|
| `l_max_size` | No | '1000' | Maximum number of changes allowed for L-sized PRs. |
|
|
|
|
| `xl_label` | No | 'size/xl' | Label for extra-large-sized PRs. |
|
|
|
|
| `fail_if_xl` | No | 'false' | Whether to fail the GitHub workflow if the PR size is 'XL' (blocks the merge). |
|
|
|
|
| `message_if_xl` | No | Custom message | Message to display when a PR exceeds the 'XL' size limit. |
|
|
|
|
| `github_api_url` | No | 'https://api.github.com' | URL for the GitHub API, can be changed for GitHub Enterprise Servers. |
|
|
|
|
| `files_to_ignore` | No | '' | Files to ignore during PR size calculation. Supports newline or whitespace delimited list. |
|
2020-03-04 14:21:23 +01:00
|
|
|
|
2024-04-15 06:10:19 -07:00
|
|
|
### Example for `files_to_ignore`:
|
2023-01-31 22:31:23 +08:00
|
|
|
```yml
|
|
|
|
files_to_ignore: 'package-lock.json *.lock'
|
|
|
|
# OR
|
|
|
|
files_to_ignore: |
|
|
|
|
"package-lock.json"
|
|
|
|
"*.lock"
|
|
|
|
"docs/*"
|
|
|
|
```
|
2024-04-15 06:10:19 -07:00
|
|
|
|
2021-03-04 11:57:35 +01:00
|
|
|
## 🤔 Basic concepts or assumptions
|
2021-03-03 12:54:34 +01:00
|
|
|
|
2024-04-15 06:10:19 -07:00
|
|
|
- PR Size Labeler considers any line addition, deletion, or modification as a change.
|
|
|
|
- A PR will be labeled as 'xl' if it exceeds the amount of changes defined in `l_max_size`.
|
2021-03-03 12:54:34 +01:00
|
|
|
|
2020-02-27 18:32:31 +01:00
|
|
|
## ⚖️ License
|
|
|
|
|
|
|
|
[MIT](LICENSE)
|