-
Notifications
You must be signed in to change notification settings - Fork 175
57 lines (51 loc) · 1.84 KB
/
pull-request-user-interaction.yaml
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
name: Pull Request User Interact
on:
pull_request_target:
types: [ edited, opened ]
branches:
- main
- release-*
env:
GITHUB_TOKEN: ${{ secrets.KUBEBLOCKS_TOKEN }}
REVIEWERS: 'realzyy,fireworm2002'
REPO: 'kubeblocks'
ISINTERACTION: ''
jobs:
get-issue-label:
name: GET PR Issue Label
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: get issue link
run: |
gh api graphql -f query='
query($org: String!,$repo: String!,$number: Int!){
repository(owner: $org, name: $repo) {
pullRequest(number: $number) {
id
closingIssuesReferences (first: 10) {
edges {
node {
number
labels (first: 10) { edges{ node {name}} }
}
}
}
}
}
}' -f org=${{ github.repository_owner }} -f repo=${{ env.REPO }} -F number=${{ github.event.pull_request.number }} > label_data.json
echo 'ISINTERACTION='$(jq '.data.repository.pullRequest.closingIssuesReferences.edges[].node.labels.edges[].node | select(.name== "area/user-interaction")' label_data.json) >> $GITHUB_ENV
- name: Add labels
if: ${{ env.ISINTERACTION != null }}
uses: actions-cool/issues-helper@v3
with:
actions: 'add-labels'
token: ${{ secrets.KUBEBLOCKS_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
labels: 'area/user-interaction'
- name: Add Pull Request Reviewers
uses: sakhnovict/add-reviewers-action@1.0.0
if: ${{ env.ISINTERACTION != null }}
with:
reviewers: ${{ env.REVIEWERS }}
token: ${{ secrets.KUBEBLOCKS_TOKEN }}