-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (89 loc) · 3.18 KB
/
Copy pathlabel.yml
File metadata and controls
105 lines (89 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Labeler
on:
pull_request:
types:
- opened
- reopened
- synchronize
- edited
- labeled
permissions:
contents: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
labeler:
name: Set labels
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
steps:
- uses: actions/checkout@v4
# Apply labels based on .github/labeler.yml (if present)
- name: Label based on changed files
uses: actions/labeler@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: true
# Label documentation branches
- name: Label documentation
if: |
startsWith(github.event.pull_request.head.ref, 'doc') ||
startsWith(github.event.pull_request.head.ref, 'docs')
run: gh pr edit "$PR_NUMBER" --add-label "documentation" --repo "$REPO"
# Label maintenance branches
- name: Label maintenance
if: |
startsWith(github.event.pull_request.head.ref, 'maint') ||
startsWith(github.event.pull_request.head.ref, 'ci')
run: gh pr edit "$PR_NUMBER" --add-label "maintenance" --repo "$REPO"
# Label feature branches
- name: Label enhancement
if: startsWith(github.event.pull_request.head.ref, 'feat')
run: gh pr edit "$PR_NUMBER" --add-label "enhancement" --repo "$REPO"
# Label bug fixes
- name: Label bug
if: |
startsWith(github.event.pull_request.head.ref, 'fix') ||
startsWith(github.event.pull_request.head.ref, 'patch')
run: gh pr edit "$PR_NUMBER" --add-label "bug" --repo "$REPO"
commenter:
name: Suggest labels
needs: labeler
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Suggest labels
if: toJSON(github.event.pull_request.labels.*.name) == '{}'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
gh pr comment "$PR_NUMBER" \
--repo "$REPOSITORY" \
--body "Please add one of these labels so the changelog can be generated: **bug**, **enhancement**, **documentation**, **maintenance**, **dependencies**, **breaking**, **test**, or **miscellaneous**."
changelog-fragment:
name: "Create changelog fragment"
needs: [labeler]
permissions:
contents: write # Required to create changelog fragment
pull-requests: write # Required to create changelog fragment
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/doc-changelog@84b6533ae76f5dde69a1df26c18682160a8121cf # v10.3.5
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
use-pull-request-title: true
use-default-towncrier-config: true
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}