Skip to content

Commit

Permalink
Port labeling system from build framework
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Sep 24, 2024
1 parent 43bea4a commit 4afe53e
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This configures label matching for PR's.
#
# The keys are labels, and the values are lists of minimatch patterns
# to which those labels apply.
#
# NOTE: This can only add labels, not remove them.
# NOTE: Due to YAML syntax limitations, patterns or labels which start
# with a character that is part of the standard YAML syntax must be
# quoted.
#
# Please keep the labels sorted and deduplicated.

"Scripts":
- all:
- changed-files:
- any-glob-to-any-file: ['lib/armbian-configng/*']

"GitHub Actions":
- all:
- changed-files:
- any-glob-to-any-file: ['.github/workflows/**/*']

"GitHub":
- all:
- changed-files:
- any-glob-to-any-file: ['.github/**/*']
- all-globs-to-any-file: ['!.github/workflows/**/*']

"Unit Tests":
- all:
- changed-files:
- any-glob-to-any-file: ['tests/*']

# Add 'Documentation' label to any change to .md files within the entire repository
"Documentation":
- changed-files:
- any-glob-to-any-file: '**/*.md'
114 changes: 114 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
- name: "02"
color: "76B4D9"
description: "Milestone: First quarter release"
- name: "05"
color: "AADB79"
description: "Milestone: Second quarter release"
- name: "08"
color: "4B649F"
description: "Milestone: Third quarter release"
- name: "11"
color: "D58125"
description: "Milestone: Fourth quarter release"
- name: "Backlog"
color: "d4c5f9"
description: "Stalled work that needs to be completed"
- name: "Breaking change"
color: "f4bd13"
description: "Can potentially break core functionality"
- name: "Bug"
color: "F92C01"
description: "Something isn't working as it should"
- name: "Bugfix"
color: "F92C01"
description: "Pull request is fixing a bug"
- name: "Dependencies"
color: "0366d6"
description: "Pull requests that update a dependency"
- name: "Discussion"
color: "EDFFE3"
description: "Being discussed - Voice your opinions :)"
- name: "Duplicate"
color: "f4bd13"
description: "Issue is already present"
- name: "Feature Request"
color: "1aac63"
description: "Feature suggestion"
- name: "Good first issue"
color: "ffb3ff"
description: "Feel free to contribute :) "
- name: "Not framework bug"
color: "CD456C"
description: "Bug in 3rd party component"
- name: "Python"
color: "2b67c6"
description: "Pull requests that update Python code "
- name: "User error"
color: "CD456C"
description: "A mistake that is made by the user"
- name: "size/small"
color: "ededed"
description: "PR with less then 50 lines"
- name: "size/medium"
color: "ededed"
description: "PR with more then 50 and less then 250 lines"
- name: "size/large"
color: "ededed"
description: "PR with 250 lines or more"
- name: "Task/To-Do"
color: "2f95f1"
description: "Project management: To-Do or task(s) someone is working on"
- name: "Desktop"
color: "bfd4f2"
description: "Graphical user interface"
- name: "Hardware"
color: "bfd4f2"
description: "Hardware related like kernel, U-Boot, ..."
- name: "Framework"
color: "bfd4f2"
description: "Framework components"
- name: "BSP"
color: "bfd4f2"
description: "Board Support Packages"
- name: "GitHub Actions"
color: "bfd4f2"
description: "GitHub Actions code"
- name: "GitHub"
color: "bfd4f2"
description: "GitHub-related changes like labels, templates, ..."
- name: "Patches"
color: "bfd4f2"
description: "Patches related to kernel, U-Boot, ..."
- name: "Documentation"
color: "bfd4f2"
description: "Documentation changes or additions"
- name: "Work in progress"
color: "29E414"
description: "Unfinished / work in progress"
- name: "Ready to merge"
color: "1d7136"
description: "Reviewed, tested and ready for merge"
- name: "Help needed"
color: "EA1BCE"
description: "We need your involvement"
- name: "Needs review"
color: "AEE054"
description: "Seeking for review"
- name: "Can be closed?"
color: "9b75fc"
description: "Ping developers on stalled issue / PR"
- name: "Build"
color: "5ee3d0"
description: "Executing build train (permission needed)"
- name: "Needs Documentation"
color: "4FD1EF"
description: "New feature needs documentation entry"
- name: "Documentation finished"
color: "0052CC"
description: "New feature was properly added to docs"
- name: "Improper usage"
color: "CD456C"
description: "Provided input is not in the expected data format or structure"
- name: "Giveaway"
color: "DA4C13"
description: "Code completition was selected to enter contributors giveaway"
36 changes: 36 additions & 0 deletions .github/workflows/labels-from-yml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Sync Labels from YAML
run-name: Sync Labels from YML on ${{ github.event_name }}

on:
workflow_dispatch:
push:
branches:
- "main"
paths:
- ".github/labels.yml"
pull_request:
paths:
- ".github/labels.yml"

jobs:
labeler:
permissions:
contents: read # for actions/labeler to determine modified files
pull-requests: write # for actions/labeler to add labels to PRs
issues: write # for actions/labeler to add labels to issues

if: ${{ github.repository_owner == 'Armbian' }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run Labeler
uses: crazy-max/ghaction-github-labeler@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
yaml-file: .github/labels.yml
dry-run: ${{ github.event_name == 'pull_request' }}
exclude: |
Maintenance*
44 changes: 44 additions & 0 deletions .github/workflows/pr-auto-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Automatic Pull Request Labeling
run-name: 'Set labels - PR #${{ github.event.pull_request.number }} ("${{ github.event.pull_request.title }}")'
#
# Set labels for pull requests automatically based on size (modified via job 'label-size') and file categories (modified via .github/labeler)
#

on:
- pull_request_target

jobs:
label-category:
permissions:
contents: read # for actions/labeler to determine modified files
pull-requests: write # for actions/labeler to add labels to PRs

name: "Category labels"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

label-size:
permissions:
contents: read # for pascalgn/size-label-action to determine modified files
pull-requests: write # for pascalgn/size-label-action to add labels to PRs

name: "Size label"
runs-on: ubuntu-latest

steps:
- name: size-label
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
sizes: >
{
"0": "small",
"50": "medium",
"250": "large"
}

0 comments on commit 4afe53e

Please sign in to comment.