-
Notifications
You must be signed in to change notification settings - Fork 1.5k
51 lines (48 loc) · 1.79 KB
/
Copy pathadd-label-community-pr.yml
File metadata and controls
51 lines (48 loc) · 1.79 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
---
name: Add labels to community PRs
on:
# run in the context of the base branch, so that it still works in PR from forks
pull_request_target:
types: [opened, synchronize, reopened]
permissions: {}
jobs:
add-label-community-prs:
name: Add labels to community PRs
runs-on: ubuntu-latest
permissions:
id-token: write
if: github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Get GitHub token
uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
id: octo-sts
with:
scope: DataDog/datadog-agent
policy: self.add-labels-pr.label-pr
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: main
token: ${{ steps.octo-sts.outputs.token }}
sparse-checkout: |
.gitlab-ci.yml
.github/CODEOWNERS
.github/actions
.ddqa/config.toml
tasks
persist-credentials: false
- name: Install dda
uses: ./.github/actions/install-dda
with:
features: legacy-tasks
- name: Set community label and warn teams
if: github.event.action == 'opened'
run: dda inv -- -e github.handle-community-pr --repo="${{ github.repository }}" --pr-id="${{ github.event.number }}" --labels="community"
env:
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}
SLACK_DATADOG_AGENT_BOT_TOKEN: ${{ secrets.SLACK_DATADOG_AGENT_BOT_TOKEN }}
- name: Assign team label
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}
run: dda inv -- -e github.assign-team-label --pr-id="${PR_NUMBER}"