Skip to content

Commit 57ad459

Browse files
committed
Add labeler files and auto-labelling workflow.
1 parent c7b045f commit 57ad459

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed

.github/labeler.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
documentation:
2+
- doc/source/**/*
3+
- README.rst
4+
maintenance:
5+
- .github/**/*
6+
- .flake8
7+
- setup.py
8+
- setup-distutils.py
9+
dependencies:
10+
- requirements.txt
11+
- requirements_docs.txt
12+
- requirements_test.txt

.github/labels.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
- name: bug
2+
description: Something isn't working
3+
color: d42a34
4+
5+
- name: dependencies
6+
description: Related with project dependencies
7+
color: ffc0cb
8+
9+
- name: documentation
10+
description: Improvements or additions to documentation
11+
color: 0677ba
12+
13+
- name: enhancement
14+
description: New features or code improvements
15+
color: FFD827
16+
17+
- name: good first issue
18+
description: Easy to solve for newcomers
19+
color: 62ca50
20+
21+
- name: maintenance
22+
description: Package and maintenance related
23+
color: f78c37
24+
25+
- name: release
26+
description: Anything related to an incoming release
27+
color: ffffff

.github/workflows/label.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Labeler
2+
on:
3+
pull_request:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- '../labels.yml'
8+
9+
10+
jobs:
11+
12+
label-syncer:
13+
name: Syncer
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: micnncim/action-label-syncer@v1
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
21+
labeler:
22+
name: Set labels
23+
needs: [label-syncer]
24+
permissions:
25+
contents: read
26+
pull-requests: write
27+
runs-on: ubuntu-latest
28+
steps:
29+
30+
# Label based on modified files
31+
- name: Label based on changed files
32+
uses: actions/labeler@v4
33+
with:
34+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
35+
sync-labels: ''
36+
37+
# Label based on branch name
38+
- uses: actions-ecosystem/action-add-labels@v1
39+
if: |
40+
startsWith(github.event.pull_request.head.ref, 'doc') ||
41+
startsWith(github.event.pull_request.head.ref, 'docs')
42+
with:
43+
labels: documentation
44+
45+
- uses: actions-ecosystem/action-add-labels@v1
46+
if: |
47+
startsWith(github.event.pull_request.head.ref, 'maint') ||
48+
startsWith(github.event.pull_request.head.ref, 'no-ci') ||
49+
startsWith(github.event.pull_request.head.ref, 'ci')
50+
with:
51+
labels: maintenance
52+
53+
- uses: actions-ecosystem/action-add-labels@v1
54+
if: startsWith(github.event.pull_request.head.ref, 'feat')
55+
with:
56+
labels: |
57+
enhancement
58+
59+
- uses: actions-ecosystem/action-add-labels@v1
60+
if: |
61+
startsWith(github.event.pull_request.head.ref, 'fix') ||
62+
startsWith(github.event.pull_request.head.ref, 'patch')
63+
with:
64+
labels: bug
65+
66+
commenter:
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Suggest to add labels
70+
uses: peter-evans/create-or-update-comment@v2
71+
# Execute only when no labels have been applied to the pull request
72+
if: toJSON(github.event.pull_request.labels.*.name) == '{}'
73+
with:
74+
issue-number: ${{ github.event.pull_request.number }}
75+
body: |
76+
Please add one of the following labels to add this contribution to the Release Notes :point_down:
77+
- [bug](https://github.com/pyansys/ansys-templates/pulls?q=label%3Abug+)
78+
- [documentation](https://github.com/pyansys/ansys-templates/pulls?q=label%3Adocumentation+)
79+
- [enhancement](https://github.com/pyansys/ansys-templates/pulls?q=label%3Aenhancement+)
80+
- [good first issue](https://github.com/pyansys/ansys-templates/pulls?q=label%3Agood+first+issue)
81+
- [maintenance](https://github.com/pyansys/ansys-templates/pulls?q=label%3Amaintenance+)
82+
- [release](https://github.com/pyansys/ansys-templates/pulls?q=label%3Arelease+)

0 commit comments

Comments
 (0)