-
-
Notifications
You must be signed in to change notification settings - Fork 214
40 lines (35 loc) · 1.2 KB
/
labeler.yml
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
name: Triage pull requests and issues
on:
issues:
types: [opened]
pull_request_target:
types: [opened]
jobs:
apply-label:
runs-on: ubuntu-latest
steps:
- name: View context attributes
uses: actions/github-script@v7
with:
script: console.log(context)
- name: Check for existing labels
id: check-issue-pr-labels
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue;
const pr = context.payload.pull_request;
function hasLabels(obj) {
return obj.labels && Array.isArray(obj.labels) && obj.labels.length > 0;
}
const hasLabelsResult = hasLabels(issue || pr);
console.log('Label count:', hasLabelsResult ? (issue || pr).labels.length : 0);
console.log('Has labels:', hasLabelsResult);
return hasLabelsResult;
- name: Label issues and PRs
if: steps.check-issue-pr-labels.outputs.result == 'false'
uses: github/[email protected]
with:
configuration-path: .github/labeler.yml
enable-versioned-regex: 0
repo-token: ${{ secrets.GITHUB_TOKEN }}