From fdf921370dca1647b054ea6b1f3a4951cd2b1285 Mon Sep 17 00:00:00 2001 From: Brian Thomas Smith Date: Wed, 17 Jan 2024 11:32:25 +0100 Subject: [PATCH] chore(ci): Switch out labeler action, use label config in workflow --- .github/pull-request-size.yml | 42 -------------------------------- .github/workflows/pr-labeler.yml | 36 +++++++++++++++++---------- 2 files changed, 23 insertions(+), 55 deletions(-) delete mode 100644 .github/pull-request-size.yml diff --git a/.github/pull-request-size.yml b/.github/pull-request-size.yml deleted file mode 100644 index 5ec773b5fbc1ac6..000000000000000 --- a/.github/pull-request-size.yml +++ /dev/null @@ -1,42 +0,0 @@ -# Configuration for PR Size Labeler - -# List of files to exclude from size calculation -# Files matching these patterns will not be considered when calculating PR size -exclude_files: - - "files/en-us/_redirects.txt" - - "files/en-us/_wikihistory.json" - -# Configuration for labeling based on the size of the Pull Request -# Each entry defines a size label, along with thresholds for diff and file count -label_configs: - # Configuration for 'extra small' PRs - - size: xs - diff: 10 # Threshold for the total lines of code changed (additions + deletions) - files: 1 # Threshold for the total number of files changed - labels: ["size/xs"] # Labels to be applied for this size - - # Configuration for 'small' PRs - - size: s - diff: 25 - files: 5 - labels: ["size/s"] - - # Configuration for 'medium' PRs - - size: m - diff: 100 - files: 10 - # Additional labels can be added, e.g.; - # labels: ["size/m", "pairing-wanted"] - labels: ["size/m"] - - # Configuration for 'large' PRs - - size: l - diff: 250 - files: 25 - labels: ["size/l"] - - # Configuration for 'extra large' PRs - - size: xl - diff: 500 - files: 50 - labels: ["size/xl"] diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index 55984b314ba8d6d..d898197baaa1462 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -1,4 +1,4 @@ -name: Pull request labeler +name: PR labeler on: - pull_request_target @@ -12,28 +12,38 @@ jobs: label-by-path: # do not run on forks if: github.repository == 'mdn/content' + name: Label by path runs-on: ubuntu-latest steps: - uses: actions/labeler@v4 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" - # Docs: https://github.com/cbrgm/pr-size-labeler-action + # Docs: https://github.com/CodelyTV/pr-size-labeler label-by-size: # do not run on forks if: github.repository == 'mdn/content' needs: label-by-path + name: Label by size runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 + - uses: codelytv/pr-size-labeler@v1 with: - persist-credentials: false - - - name: Label PR based on size - uses: cbrgm/pr-size-labeler-action@main - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - github_repository: ${{ github.repository }} # Repository name - github_pr_number: ${{ github.event.number }} # Pull request number - config_file_path: ".github/pull-request-size.yml" # Path to pr-size-labeler config + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_api_url: "https://api.github.com" + xs_label: "size/xs" + xs_max_size: "5" + s_label: "size/s" + s_max_size: "10" + m_label: "size/m" + m_max_size: "50" + l_label: "size/l" + l_max_size: "100" + xl_label: "size/xl" + fail_if_xl: "false" + # message_if_xl: > + # This PR exceeds the recommended size of 1000 lines. + # ... + files_to_ignore: | + "files/en-us/_redirects.txt" + "files/en-us/_wikihistory.json"