File: labeler.yml

package info (click to toggle)
systemd-udeb 260-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 114,360 kB
  • sloc: ansic: 741,727; xml: 122,306; python: 35,714; sh: 35,154; cpp: 947; awk: 126; makefile: 89; lisp: 13; sed: 1
file content (136 lines) | stat: -rw-r--r-- 5,147 bytes parent folder | download | duplicates (2)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
---
# vi: ts=2 sw=2 et:
# SPDX-License-Identifier: LGPL-2.1-or-later
#
name: "Pull Request Labeler"

on:
  pull_request_target:
    types: [opened, synchronize, reopened, ready_for_review, closed]
    paths-ignore:
      - '.github/labeler.yml'
      - '.github/workflows/labeler.yml'
  # Allow testing changes made to the labeler configuration
  pull_request:
    paths:
      - '.github/labeler.yml'
      - '.github/workflows/labeler.yml'
  issue_comment:
    types: [created]

permissions:
  contents: read

jobs:
  triage:
    if: github.repository == 'systemd/systemd'
    runs-on: ubuntu-24.04
    permissions:
      pull-requests: write

    steps:
    - name: Repository checkout
      uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
      if: github.event_name == 'pull_request'
      with:
        persist-credentials: false

    - name: Label PR based on policy in labeler.yml
      uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b
      if: startsWith(github.event_name, 'pull_request') && github.base_ref == 'main' && github.event.action != 'closed'
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        configuration-path: .github/labeler.yml
        sync-labels: false

    - name: Set or remove labels based on systemd development workflow
      uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
      if: startsWith(github.event_name, 'pull_request') && github.event.action != 'closed' && !github.event.pull_request.draft
      with:
        script: |
          response = await github.rest.issues.listLabelsOnIssue({
            issue_number: context.issue.number,
            owner: context.repo.owner,
            repo: context.repo.repo,
          });

          original = new Set(response.data.map(l => l.name));
          labels = new Set(original);

          good_to_merge = new Set([
            "good-to-merge/waiting-for-ci 👍",
            "good-to-merge/after-next-release",
            "good-to-merge/with-minor-suggestions",
            "good-to-merge/waiting-for-reporter-feedback 👍",
          ]);

          if (Array.from(labels).filter(l => good_to_merge.has(l)).length == 0) {
            labels.add("please-review");
          }

          for (const label of ["reviewed/needs-rework 🔨",
                               "ci-fails/needs-rework 🔥",
                               "ci-failure-appears-unrelated",
                               "needs-rebase"]) {
            labels.delete(label);
          }

          if (labels.size != original.size || Array.from(labels).some(l => !original.has(l))) {
            await github.rest.issues.setLabels({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              labels: Array.from(labels),
            });
          }

    - name: Add please-review label on command in issue comment
      uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
      if: github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/please-review')
      with:
        script: |
          await github.rest.issues.addLabels({
            issue_number: context.issue.number,
            owner: context.repo.owner,
            repo: context.repo.repo,
            labels: ["please-review"]
          })

    - name: Remove specific labels when PR is closed or merged
      uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
      if: startsWith(github.event_name, 'pull_request') && github.event.action == 'closed'
      with:
        script: |
          response = await github.rest.issues.listLabelsOnIssue({
            issue_number: context.issue.number,
            owner: context.repo.owner,
            repo: context.repo.repo,
          });

          original = new Set(response.data.map(l => l.name));
          labels = new Set(original);

          for (const label of ["please-review",
                               "reviewed/needs-rework 🔨",
                               "ci-fails/needs-rework 🔥",
                               "needs-rebase",
                               "good-to-merge/waiting-for-ci 👍",
                               "good-to-merge/after-next-release",
                               "good-to-merge/with-minor-suggestions",
                               "good-to-merge/waiting-for-reporter-feedback 👍",
                               "needs-discussion 🤔",
                               "needs-reporter-feedback ❓",
                               "dont-merge 💣",
                               "squash-on-merge",
                               "quick-review 🏃‍♂️"]) {
            labels.delete(label);
          }

          if (labels.size != original.size || Array.from(labels).some(l => !original.has(l))) {
            await github.rest.issues.setLabels({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              labels: Array.from(labels),
            });
          }