forked from kubernetes-sigs/kueue
-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (75 loc) · 2.13 KB
/
add-issues-by-user.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: 'KDEV: Add all by user'
run-name: Add ${{inputs.status}} @${{inputs.gh_user}} issues + pulls
on:
workflow_call:
inputs:
gh_repo:
type: string
required: true
gh_user:
type: string
required: true
status:
type: string
default: open
secrets:
GH_TOKEN:
required: true
workflow_dispatch:
inputs:
gh_repo:
description: 'Repository name'
required: true
default: 'kubernetes-sigs/kueue'
gh_user:
description: 'Assignee'
required: true
default: trasc
type: choice
options:
- trasc
- mcariatm
- akranga
- oginskis
- stuton
- mbobrovskyi
- vladikkuzn
- IrvingMg
- mszadkow
- mykysha
status:
description: 'Status'
required: true
default: open
type: choice
options:
- open
- closed
- all
jobs:
Add-Issue-to-KDEV:
runs-on: ubuntu-latest
env:
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PROJECT_ACCESS }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
# KDEV
PROJECT_ID: PVT_kwDOABhCKs4APR3F
steps:
- name: Get ${{inputs.gh_user}} issues
id: issues
run: echo ids=$(gh api 'repos/${{inputs.gh_repo}}/issues?state=${{inputs.status}}&assignee=${{inputs.gh_user}}' -q '.[].node_id' | xargs) >> $GITHUB_OUTPUT
- name: Get ${{inputs.gh_user}} PRs
id: pulls
run: echo ids=$(gh api 'repos/${{inputs.gh_repo}}/pulls?state=${{inputs.status}}' -q '.[] | select(.user.login=="${{inputs.gh_user}}") | .node_id' | xargs) >> $GITHUB_OUTPUT
- name: Add to KDEV
run: |
for issue in ${{ steps.issues.outputs.ids }} ${{ steps.pulls.outputs.ids }}; do
gh api graphql -f query='
mutation($project:ID!, $content:ID!) {
addProjectV2ItemById(input: {projectId: $project contentId: $content}) {
item {
id
}
}
}' -f project=$PROJECT_ID -f content=$issue
done