File tree 2 files changed +46
-0
lines changed
2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ We are using [GitHub Actions](https://github.com/features/actions) as a continuo
5
5
For details, take a look at the following workflow configuration files:
6
6
7
7
- [ ` workflows/integrate.yaml ` ] ( workflows/integrate.yaml )
8
+ - [ ` workflows/triage.yaml ` ] ( workflows/triage.yaml )
8
9
9
10
## Coding Standards
10
11
Original file line number Diff line number Diff line change
1
+ # https://docs.github.com/en/actions
2
+
3
+ name : " Triage"
4
+
5
+ on : # yamllint disable-line rule:truthy
6
+ pull_request :
7
+ types :
8
+ - " opened"
9
+
10
+ jobs :
11
+ label :
12
+ name : " Label"
13
+
14
+ runs-on : " ubuntu-latest"
15
+
16
+ steps :
17
+ - name : " Add labels based on branch name"
18
+ uses : " actions/github-script@v2.0.0"
19
+ with :
20
+ github-token : " ${{ secrets.ERGEBNIS_BOT_TOKEN }}"
21
+ script : |
22
+ const branchPrefixLabels = {
23
+ feature: "enhancement",
24
+ fix: "bug",
25
+ }
26
+
27
+ const pullRequest = context.payload.pull_request
28
+ const repository = context.repo
29
+
30
+ const branchName = pullRequest.head.ref
31
+
32
+ const matches = branchName.match(new RegExp('^([^/]+)\/'));
33
+
34
+ if (matches instanceof Array && branchPrefixLabels.hasOwnProperty(matches[1])) {
35
+ const label = branchPrefixLabels[matches[1]]
36
+
37
+ github.issues.addLabels({
38
+ issue_number: pullRequest.number,
39
+ labels: [
40
+ label
41
+ ],
42
+ owner: repository.owner,
43
+ repo: repository.repo,
44
+ });
45
+ }
You can’t perform that action at this time.
0 commit comments