Skip to content

Commit 743d305

Browse files
committed
GHA - copy labels actions from build repository
1 parent a945e30 commit 743d305

File tree

4 files changed

+317
-0
lines changed

4 files changed

+317
-0
lines changed

.github/labeler.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This configures label matching for PR's.
2+
#
3+
# The keys are labels, and the values are lists of minimatch patterns
4+
# to which those labels apply.
5+
#
6+
# NOTE: This can only add labels, not remove them.
7+
# NOTE: Due to YAML syntax limitations, patterns or labels which start
8+
# with a character that is part of the standard YAML syntax must be
9+
# quoted.
10+
#
11+
# Please keep the labels sorted and deduplicated.
12+
13+
"Needs review":
14+
- changed-files:
15+
- any-glob-to-any-file: '**'
16+
17+
"Hardware":
18+
- all:
19+
- changed-files:
20+
- any-glob-to-any-file: ['patch/**/*','config/**/*']
21+
- all-globs-to-all-files: ['!config/cli/**/*','!config/desktop/**/*','!config/distributions/**/*']
22+
23+
"Framework":
24+
- all:
25+
- changed-files:
26+
- any-glob-to-any-file: ['lib/**/*','tools/**/*','config/cli/**/*','extensions/**/*']
27+
28+
"BSP":
29+
- all:
30+
- changed-files:
31+
- any-glob-to-any-file: ['packages/**/*']
32+
33+
"GitHub Actions":
34+
- all:
35+
- changed-files:
36+
- any-glob-to-any-file: ['.github/workflows/**/*']
37+
38+
"GitHub":
39+
- all:
40+
- changed-files:
41+
- any-glob-to-any-file: ['.github/**/*']
42+
- all-globs-to-any-file: ['!.github/workflows/**/*']
43+
44+
"Desktop":
45+
- all:
46+
- changed-files:
47+
- any-glob-to-any-file: ['config/desktop/**/*']
48+
49+
"Patches":
50+
- all:
51+
- changed-files:
52+
- any-glob-to-any-file: ['patch/**/*']
53+
54+
# Add 'Documentation' label to any change to .md files within the entire repository
55+
"Documentation":
56+
- changed-files:
57+
- any-glob-to-any-file: '**/*.md'

.github/labels.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
- name: "02"
2+
color: "76B4D9"
3+
description: "Milestone: First quarter release"
4+
- name: "05"
5+
color: "AADB79"
6+
description: "Milestone: Second quarter release"
7+
- name: "08"
8+
color: "4B649F"
9+
description: "Milestone: Third quarter release"
10+
- name: "11"
11+
color: "D58125"
12+
description: "Milestone: Fourth quarter release"
13+
- name: "Backlog"
14+
color: "d4c5f9"
15+
description: "Stalled work that needs to be completed"
16+
- name: "Breaking change"
17+
color: "f4bd13"
18+
description: "Can potentially break core functionality"
19+
- name: "Bug"
20+
color: "F92C01"
21+
description: "Something isn't working as it should"
22+
- name: "Bugfix"
23+
color: "F92C01"
24+
description: "Pull request is fixing a bug"
25+
- name: "Dependencies"
26+
color: "0366d6"
27+
description: "Pull requests that update a dependency"
28+
- name: "Discussion"
29+
color: "EDFFE3"
30+
description: "Being discussed - Voice your opinions :)"
31+
- name: "Duplicate"
32+
color: "f4bd13"
33+
description: "Issue is already present"
34+
- name: "Feature Request"
35+
color: "1aac63"
36+
description: "Feature suggestion"
37+
- name: "Good first issue"
38+
color: "ffb3ff"
39+
description: "Feel free to contribute :) "
40+
- name: "Not framework bug"
41+
color: "CD456C"
42+
description: "Bug in 3rd party component"
43+
- name: "Python"
44+
color: "2b67c6"
45+
description: "Pull requests that update Python code "
46+
- name: "User error"
47+
color: "CD456C"
48+
description: "A mistake that is made by the user"
49+
- name: "size/small"
50+
color: "ededed"
51+
description: "PR with less then 50 lines"
52+
- name: "size/medium"
53+
color: "ededed"
54+
description: "PR with more then 50 and less then 250 lines"
55+
- name: "size/large"
56+
color: "ededed"
57+
description: "PR with 250 lines or more"
58+
- name: "Task/To-Do"
59+
color: "2f95f1"
60+
description: "Project management: To-Do or task(s) someone is working on"
61+
- name: "Desktop"
62+
color: "bfd4f2"
63+
description: "Graphical user interface"
64+
- name: "Hardware"
65+
color: "bfd4f2"
66+
description: "Hardware related like kernel, U-Boot, ..."
67+
- name: "Framework"
68+
color: "bfd4f2"
69+
description: "Framework components"
70+
- name: "BSP"
71+
color: "bfd4f2"
72+
description: "Board Support Packages"
73+
- name: "GitHub Actions"
74+
color: "bfd4f2"
75+
description: "GitHub Actions code"
76+
- name: "GitHub"
77+
color: "bfd4f2"
78+
description: "GitHub-related changes like labels, templates, ..."
79+
- name: "Patches"
80+
color: "bfd4f2"
81+
description: "Patches related to kernel, U-Boot, ..."
82+
- name: "Documentation"
83+
color: "bfd4f2"
84+
description: "Documentation changes or additions"
85+
- name: "Work in progress"
86+
color: "29E414"
87+
description: "Unfinished / work in progress"
88+
- name: "Ready to merge"
89+
color: "1d7136"
90+
description: "Reviewed, tested and ready for merge"
91+
- name: "Help needed"
92+
color: "EA1BCE"
93+
description: "We need your involvement"
94+
- name: "Needs review"
95+
color: "AEE054"
96+
description: "Seeking for review"
97+
- name: "Can be closed?"
98+
color: "9b75fc"
99+
description: "Ping developers on stalled issue / PR"
100+
- name: "Build"
101+
color: "5ee3d0"
102+
description: "Executing build train (permission needed)"
103+
- name: "Needs Documentation"
104+
color: "4FD1EF"
105+
description: "New feature needs documentation entry"
106+
- name: "Documentation finished"
107+
color: "0052CC"
108+
description: "New feature was properly added to docs"
109+
- name: "Improper usage"
110+
color: "CD456C"
111+
description: "Provided input is not in the expected data format or structure"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Sync Labels from YAML
2+
run-name: Sync Labels from YML on ${{ github.event_name }}
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- "main"
9+
paths:
10+
- ".github/labels.yml"
11+
pull_request:
12+
paths:
13+
- ".github/labels.yml"
14+
15+
jobs:
16+
labeler:
17+
permissions:
18+
contents: read # for actions/labeler to determine modified files
19+
pull-requests: write # for actions/labeler to add labels to PRs
20+
issues: write # for actions/labeler to add labels to issues
21+
22+
if: ${{ github.repository_owner == 'Armbian' }}
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Run Labeler
30+
uses: crazy-max/ghaction-github-labeler@v5
31+
with:
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
yaml-file: .github/labels.yml
34+
dry-run: ${{ github.event_name == 'pull_request' }}
35+
exclude: |
36+
Maintenance*
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Automatic Pull Request Labeling
2+
3+
# Sets labels automatically based on:
4+
# - PR size (job: label-size)
5+
# - File categories using .github/labeler config (job: label-category)
6+
# - PR creation date for quarterly tracking (job: label-by-date)
7+
# - Removes "Ready to merge" label on PR update (job: label-remove)
8+
9+
run-name: 'Set labels - PR #${{ github.event.pull_request.number }} ("${{ github.event.pull_request.title }}")'
10+
11+
on: pull_request_target
12+
13+
# Grant required permissions globally
14+
permissions:
15+
contents: read # Required for checking changed files
16+
pull-requests: write # Required for labeling PRs
17+
issues: write # Required for adding/removing labels
18+
19+
jobs:
20+
label-remove:
21+
name: "Remove Ready to merge"
22+
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }}
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout the pull request
27+
uses: actions/checkout@v4
28+
29+
- name: Check for label using GH CLI
30+
id: check
31+
run: |
32+
gh pr view ${{ github.event.pull_request.number }} --json labels -q '.labels[].name' | grep -q 'Ready to merge' && echo "has_label=true" >> $GITHUB_OUTPUT || echo "has_label=false" >> $GITHUB_OUTPUT
33+
env:
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Remove "Ready to merge" label
37+
if: steps.check.outputs.has_label == 'true'
38+
uses: PauMAVA/[email protected]
39+
with:
40+
github_token: ${{ secrets.GITHUB_TOKEN }}
41+
add: ""
42+
remove: "Ready to merge"
43+
44+
label-category:
45+
name: "Category Labels"
46+
runs-on: ubuntu-latest
47+
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }}
48+
49+
steps:
50+
# Checks out the repository to read files for matching with labeler config
51+
- uses: actions/checkout@v4
52+
53+
# Applies labels based on the .github/labeler.yml config
54+
- uses: actions/labeler@v5
55+
with:
56+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
57+
58+
label-size:
59+
name: "Size Label"
60+
runs-on: ubuntu-latest
61+
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }}
62+
63+
steps:
64+
# Automatically adds size labels based on total changed lines
65+
- name: Label by size
66+
uses: pascalgn/[email protected]
67+
env:
68+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
69+
with:
70+
sizes: >
71+
{
72+
"0": "small",
73+
"50": "medium",
74+
"250": "large"
75+
}
76+
77+
label-by-date:
78+
name: "Date label (Quarters)"
79+
runs-on: ubuntu-latest
80+
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }}
81+
82+
steps:
83+
# Determines the label (02, 05, 08, 11) based on PR creation month
84+
- name: Determine quarter label
85+
env:
86+
PR_CREATED_AT: ${{ github.event.pull_request.created_at }}
87+
run: |
88+
echo "PR created at: $PR_CREATED_AT"
89+
90+
# Extract the numeric month (e.g., 04 for April)
91+
MONTH=$(date -d "$PR_CREATED_AT" +%m | sed 's/^0*//')
92+
echo "Month extracted: $MONTH"
93+
94+
# Determine quarter-end label based on month
95+
if [ "$MONTH" -le 2 ] || [ "$MONTH" -eq 12 ]; then
96+
LABEL="02"
97+
elif [ "$MONTH" -le 5 ]; then
98+
LABEL="05"
99+
elif [ "$MONTH" -le 8 ]; then
100+
LABEL="08"
101+
else
102+
LABEL="11"
103+
fi
104+
105+
# Set as environment variable for next step
106+
echo "LABEL=${LABEL}" >> $GITHUB_ENV
107+
108+
# Adds the quarter label to the PR
109+
- name: Add quarter label
110+
uses: PauMAVA/[email protected]
111+
with:
112+
github_token: ${{ secrets.GITHUB_TOKEN }}
113+
add: "${{ env.LABEL }}"

0 commit comments

Comments
 (0)