-
Notifications
You must be signed in to change notification settings - Fork 1.5k
141 lines (135 loc) · 4.91 KB
/
Copy pathlabel-analysis.yml
File metadata and controls
141 lines (135 loc) · 4.91 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
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
137
138
139
140
141
---
name: "Label analysis"
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
- "[0-9]+.[0-9]+.x"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
permissions: {}
jobs:
assign-team-label:
if: github.triggering_actor != 'dd-devflow[bot]' && github.event.pull_request.head.repo.full_name == github.repository # Run only on non-fork PRs
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Install dda
uses: ./.github/actions/install-dda
with:
features: legacy-tasks
- name: Auto assign team label
env:
PR_ID: ${{ github.event.pull_request.number }}
run: dda inv -- -e github.assign-team-label --pr-id="$PR_ID"
release-note-check:
if: github.triggering_actor != 'dd-devflow[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
persist-credentials: false
- name: Install dda
uses: ./.github/actions/install-dda
with:
features: legacy-tasks
- name: Check release note
env:
BRANCH_NAME: ${{ github.head_ref }}
PR_ID: ${{ github.event.pull_request.number }}
run: dda inv -- -e linter.releasenote
fetch-labels:
needs: assign-team-label
if: github.triggering_actor != 'dd-devflow[bot]'
runs-on: ubuntu-latest
outputs:
LABELS: ${{ steps.pr-labels.outputs.LABELS }}
steps:
- name: Get PR labels
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
EVENT_NUMBER: ${{ github.event.number }}
id: pr-labels
run: |
labels="$(gh pr view "$PR_NUMBER" --json labels --jq '[.labels[].name] | (join(" "))')"
echo "Fetched labels for PR $EVENT_NUMBER: $labels"
echo "LABELS=$labels" >> "$GITHUB_OUTPUT"
team-label-check:
needs: fetch-labels
if: github.triggering_actor != 'dd-devflow[bot]'
runs-on: ubuntu-latest
steps:
- name: Check team assignment
run: |
for label in $LABELS; do
if [[ "$label" =~ ^qa/ ]]; then
echo "A label to skip QA is set -- no need for team assignment"
exit 0
fi
if [[ "$label" =~ ^team/ && "$label" != team/triage ]]; then
echo "Team label found: $label"
exit 0
fi
done
echo "PR ${{github.event.number}} requires at least one non-triage team assignment label (label starting by 'team/')"
exit 1
env:
LABELS: ${{ needs.fetch-labels.outputs.LABELS}}
skip-qa-check:
needs: fetch-labels
if: github.triggering_actor != 'dd-devflow[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Install dda
uses: ./.github/actions/install-dda
with:
features: legacy-tasks
- name: Check qa/[done|no-code-change] labels are not set together
env:
LABELS: ${{ needs.fetch-labels.outputs.LABELS}}
run: |
dda inv -- -e github.check-qa-labels --labels "${LABELS[@]}"
agenttelemetry-list-change-ack-check:
if: github.triggering_actor != 'dd-devflow[bot]' && github.event.pull_request.head.repo.full_name == github.repository # Run only on non-fork PRs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.head_ref }}
- name: Install dda
uses: ./.github/actions/install-dda
with:
features: legacy-tasks
- name: Check agent telemetry metric list
run: dda inv -- -e github.agenttelemetry-list-change-ack-check --pr-id=${{ github.event.pull_request.number }}
ask-reviews:
if: github.triggering_actor != 'dd-devflow[bot]' && github.event.action == 'labeled' && github.event.label.name == 'ask-review'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Install dda
uses: ./.github/actions/install-dda
with:
features: legacy-tasks
- name: Ask for code reviews
env:
SLACK_DATADOG_AGENT_BOT_TOKEN : ${{ secrets.SLACK_DATADOG_AGENT_BOT_TOKEN }}
run: dda inv -- -e issue.ask-reviews -p ${{ github.event.pull_request.number }}