| 1 | # Adds a comment to new PRs, showing the compressed size and size difference of new code | 1 | # Adds labels to pull requests based on the size of the changes (changed lines) |
| 2 | # And also labels the PR based on the number of lines changes | 2 | |
| | 3 | # 🏷 Pull Request Size Labeler |
| | 4 | # https://github.com/marketplace/actions/pull-request-size-labeler |
| | 5 | |
| | 6 | name: 🌈 Label PR Size |
| 3 | | 7 | |
| 4 | name: 🌈 Check PR Size | | |
| 5 | on: [pull_request] | 8 | on: [pull_request] |
| | 9 | |
| 6 | jobs: | 10 | jobs: |
| 7 | build: | 11 | labeler: |
| | 12 | permissions: |
| | 13 | pull-requests: write |
| | 14 | contents: read |
| | 15 | issues: write |
| 8 | runs-on: ubuntu-latest | 16 | runs-on: ubuntu-latest |
| | 17 | name: Label the PR size |
| 9 | steps: | 18 | steps: |
| 10 | - name: Checkout | | |
| 11 | uses: actions/checkout@v2 | | |
| 12 | # Find and comment with compressed size | | |
| 13 | - name: Get Compressed Size | | |
| 14 | uses: preactjs/compressed-size-action@v2 | | |
| 15 | with: | | |
| 16 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | | |
| 17 | pattern: './dist/**/*.{js,css,html}' | | |
| 18 | strip-hash: '\\b\\w{8}\\.' | | |
| 19 | exclude: '**/node_modules/**' | | |
| 20 | minimum-change-threshold: 100 | | |
| 21 | # Check number of lines of code added | | |
| 22 | - name: Label based on Lines of Code | | |
| 23 | uses: codelytv/pr-size-labeler@v1 | | |
| 24 | with: | | |
| 25 | GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | | |
| 26 | xs_max_size: '10' | | |
| 27 | s_max_size: '100' | | |
| 28 | m_max_size: '500' | | |
| 29 | l_max_size: '1000' | | |
| 30 | s_label: '🟩 PR - Small' | | |
| 31 | m_label: '🟨 PR - Medium' | | |
| 32 | l_label: '🟧 PR - Large' | | |
| 33 | xl_label: '🟥 PR - XL' | | |
| 34 | fail_if_xl: 'false' | | |
| 35 | message_if_xl: > | | |
| 36 | It looks like this PR is very large (over 1000 lines). | | |
| 37 | Try to avoid addressing multiple issues in a single PR, and | | |
| 38 | in the future consider breaking large tasks down into smaller steps. | | |
| 39 | This it to make reviewing, testing, reverting and general quality management easier. | | |
| 39 |
\ No newline at end of file | |
\ No newline at end of file |
| | 19 | - uses: codelytv/pr-size-labeler@v1 |
| | 20 | with: |
| | 21 | GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} |
| | 22 | xs_label: 'PR - Small' |
| | 23 | xs_max_size: '1' |
| | 24 | s_label: 'PR - Small' |
| | 25 | s_max_size: '100' |
| | 26 | m_label: 'PR - Medium' |
| | 27 | m_max_size: '500' |
| | 28 | l_label: 'PR - Large' |
| | 29 | l_max_size: '1000' |
| | 30 | xl_label: 'PR - XL' |
| | 31 | fail_if_xl: 'false' |
| | 32 | message_if_xl: > |
| | 33 | This PR exceeds the recommended size of 1000 lines. |
| | 34 | Please make sure you are not addressing multiple issues with one PR. |
| | 35 | Note this PR might be rejected due to its size. |
| | 36 | github_api_url: 'https://api.github.com' |
| | 37 | files_to_ignore: | |
| | 38 | "package-lock.json" |
| | 39 | "public/lib/*" |