Skip to content

Commit a7a05e1

Browse files
committed
added new automations
1 parent d1b8793 commit a7a05e1

5 files changed

Lines changed: 104 additions & 86 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Label PRs Based on Files
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
labeler:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Label PRs
19+
uses: actions/labeler@v5
20+
with:
21+
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/auto-label-gssoc.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ jobs:
2222
runs-on: ubuntu-latest
2323

2424
steps:
25-
- name: Add gssoc-26 label to new issue
25+
- name: Add gssoc-2026 label to new issue
2626
uses: actions/github-script@v7
2727
with:
2828
script: |
2929
github.rest.issues.addLabels({
3030
owner: context.repo.owner,
3131
repo: context.repo.repo,
3232
issue_number: context.payload.issue.number,
33-
labels: ['gssoc-26']
33+
labels: ['gssoc-2026']
3434
})
3535
3636
# ------------------------------------------------------------
@@ -41,7 +41,7 @@ jobs:
4141
runs-on: ubuntu-latest
4242

4343
steps:
44-
- name: Add gssoc-26 label to all open issues
44+
- name: Add gssoc-2026 label to all open issues
4545
uses: actions/github-script@v7
4646
with:
4747
script: |
@@ -62,7 +62,7 @@ jobs:
6262
owner: context.repo.owner,
6363
repo: context.repo.repo,
6464
issue_number: issue.number,
65-
labels: ['gssoc-26']
65+
labels: ['gssoc-2026']
6666
});
6767
6868
console.log(`Added label to issue #${issue.number}`);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Auto Label Issues
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
permissions:
8+
issues: write
9+
10+
jobs:
11+
label-issues:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Add default issue labels
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
await github.rest.issues.addLabels({
20+
owner: context.repo.owner,
21+
repo: context.repo.repo,
22+
issue_number: context.payload.issue.number,
23+
labels: ['gssoc-2026']
24+
});

.github/workflows/auto-label-prs.yml

Lines changed: 33 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,11 @@ on:
77
- reopened
88
- synchronize
99

10-
workflow_dispatch:
11-
1210
permissions:
1311
pull-requests: write
1412

1513
jobs:
16-
17-
# ------------------------------------------------------------
18-
# Auto-label new pull requests
19-
# ------------------------------------------------------------
20-
auto-label-new-prs:
21-
if: github.event_name == 'pull_request'
14+
auto-label-prs:
2215
runs-on: ubuntu-latest
2316

2417
steps:
@@ -29,95 +22,53 @@ jobs:
2922
const pr = context.payload.pull_request;
3023
const branch = pr.head.ref;
3124
32-
let labels = ['gssoc-26'];
25+
let labels = ['gssoc-2026', 'needs review'];
26+
27+
// Difficulty Labels
28+
if (branch.startsWith('level1/')) {
29+
labels.push('level:beginner');
30+
}
31+
32+
if (branch.startsWith('level2/')) {
33+
labels.push('level:intermediate');
34+
}
35+
36+
if (branch.startsWith('level3/')) {
37+
labels.push('level:advanced');
38+
}
39+
40+
if (branch.startsWith('level4/')) {
41+
labels.push('level:critical');
42+
}
3343
34-
if (branch.startsWith('fix/')) {
35-
labels.push('bug');
44+
// Type Labels
45+
if (branch.includes('fix/')) {
46+
labels.push('type:bug');
3647
}
3748
38-
if (branch.startsWith('feat/')) {
39-
labels.push('enhancement');
49+
if (branch.includes('feat/')) {
50+
labels.push('type:feature');
4051
}
4152
42-
if (branch.startsWith('docs/')) {
43-
labels.push('documentation');
53+
if (branch.includes('docs/')) {
54+
labels.push('type:docs');
4455
}
4556
46-
if (branch.startsWith('style/')) {
47-
labels.push('ui');
57+
if (branch.includes('refactor/')) {
58+
labels.push('type:refactor');
4859
}
4960
50-
if (branch.startsWith('test/')) {
51-
labels.push('testing');
61+
if (branch.includes('test/')) {
62+
labels.push('type:testing');
5263
}
5364
54-
if (branch.startsWith('refactor/')) {
55-
labels.push('refactor');
65+
if (branch.includes('style/')) {
66+
labels.push('type:design');
5667
}
5768
5869
await github.rest.issues.addLabels({
5970
owner: context.repo.owner,
6071
repo: context.repo.repo,
6172
issue_number: pr.number,
6273
labels
63-
});
64-
65-
# ------------------------------------------------------------
66-
# Apply labels to ALL existing PRs
67-
# ------------------------------------------------------------
68-
label-existing-prs:
69-
if: github.event_name == 'workflow_dispatch'
70-
runs-on: ubuntu-latest
71-
72-
steps:
73-
- name: Label all existing PRs
74-
uses: actions/github-script@v7
75-
with:
76-
script: |
77-
const pulls = await github.paginate(
78-
github.rest.pulls.list,
79-
{
80-
owner: context.repo.owner,
81-
repo: context.repo.repo,
82-
state: 'all'
83-
}
84-
);
85-
86-
for (const pr of pulls) {
87-
88-
const branch = pr.head.ref;
89-
let labels = ['gssoc-26'];
90-
91-
if (branch.startsWith('fix/')) {
92-
labels.push('bug');
93-
}
94-
95-
if (branch.startsWith('feat/')) {
96-
labels.push('enhancement');
97-
}
98-
99-
if (branch.startsWith('docs/')) {
100-
labels.push('documentation');
101-
}
102-
103-
if (branch.startsWith('style/')) {
104-
labels.push('ui');
105-
}
106-
107-
if (branch.startsWith('test/')) {
108-
labels.push('testing');
109-
}
110-
111-
if (branch.startsWith('refactor/')) {
112-
labels.push('refactor');
113-
}
114-
115-
await github.rest.issues.addLabels({
116-
owner: context.repo.owner,
117-
repo: context.repo.repo,
118-
issue_number: pr.number,
119-
labels
120-
});
121-
122-
console.log(`Labels added to PR #${pr.number}`);
123-
}
74+
});

.github/workflows/labeler.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
ui:
2+
- changed-files:
3+
- any-glob-to-any-file:
4+
- "templates/**"
5+
- "static/**"
6+
7+
documentation:
8+
- changed-files:
9+
- any-glob-to-any-file:
10+
- "README.md"
11+
- "docs/**"
12+
- "CONTRIBUTING.md"
13+
14+
data:
15+
- changed-files:
16+
- any-glob-to-any-file:
17+
- "data/**"
18+
19+
type:testing:
20+
- changed-files:
21+
- any-glob-to-any-file:
22+
- "tests/**"

0 commit comments

Comments
 (0)