Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codelytv/pr-size-labeler
🏷 Visualize and optionally limit the size of your Pull Requests
https://github.com/codelytv/pr-size-labeler
action automation codely codelytv github github-action github-actions pull-request pull-request-action pull-request-management pull-requests
Last synced: 5 days ago
JSON representation
🏷 Visualize and optionally limit the size of your Pull Requests
- Host: GitHub
- URL: https://github.com/codelytv/pr-size-labeler
- Owner: CodelyTV
- License: mit
- Created: 2020-02-27T14:24:42.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-14T13:51:03.000Z (3 months ago)
- Last Synced: 2024-10-29T12:40:27.228Z (3 months ago)
- Topics: action, automation, codely, codelytv, github, github-action, github-actions, pull-request, pull-request-action, pull-request-management, pull-requests
- Language: Shell
- Homepage: https://github.com/marketplace/actions/pull-request-size-labeler
- Size: 71.3 KB
- Stars: 343
- Watchers: 5
- Forks: 60
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
🏷 Pull Request Size Labeler
Visualize and optionally limit the size of your Pull Requests## 🚀 Usage
Create a file named `labeler.yml` inside the `.github/workflows` directory and paste the following configuration.
> [!NOTE]
> Take into account that PR Size Labeler considers any line addition, deletion, or modification as a change by default, but you can configure it with [optional arguments](https://github.com/CodelyTV/pr-size-labeler?tab=readme-ov-file#%EF%B8%8F-arguments) such as `files_to_ignore`, `ignore_file_deletions`, or even `ignore_line_deletions`.```yml
name: labeleron: [pull_request]
jobs:
labeler:
permissions:
pull-requests: write
contents: read
issues: write
runs-on: ubuntu-latest
name: Label the PR size
steps:
- uses: codelytv/pr-size-labeler@v1
with:
xs_label: 'size/xs'
xs_max_size: '10'
s_label: 'size/s'
s_max_size: '100'
m_label: 'size/m'
m_max_size: '500'
l_label: 'size/l'
l_max_size: '1000'
xl_label: 'size/xl'
fail_if_xl: 'false'
message_if_xl: >
This PR exceeds the recommended size of 1000 lines.
Please make sure you are NOT addressing multiple issues with one PR.
Note this PR might be rejected due to its size.
github_api_url: 'https://api.github.com'
files_to_ignore: ''
```> [!TIP]
> Replace `on: [pull_request]` with `on: [pull_request_target]` when using forks and when you don't want any PR to be able to execute code ([more info: GitHub docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target)).## 🎛️ Arguments
| Name | Required | Default Value | Description |
|-------------------------|----------|----------------------|---------------------------------------------------------------------------------------------------------------------------|
| `GITHUB_TOKEN` | No | 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. A PR will be labeled as 'xl' if it exceeds the amount of changes defined in `l_max_size` |
| `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. |
| `ignore_line_deletions` | No | 'false' | Whether to ignore lines which are deleted when calculating the PR size. If set to 'true', deleted lines will be ignored. |
| `ignore_file_deletions` | No | 'false' | Whether to ignore completely deleted files when calculating the PR size. If set to 'true', deleted files will be ignored. Distinct from `ignore_line_deletions` in that it only ignores files which are deleted completely. If `ignore_line_deletions` is used then using `ignore_file_deletions` is redundant. |### Example for `files_to_ignore`
```yml
files_to_ignore: 'package-lock.json *.lock'
# OR
files_to_ignore: |
"package-lock.json"
"*.lock"
"docs/*"
```## Contributing
If you would like to help improve the project, please read the [contribution guidelines](https://github.com/CodelyTV/pr-size-labeler/blob/main/.github/CONTRIBUTIONS.md).
## ⚖️ License
[MIT](LICENSE)