File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Estimate-review
2
+
3
+ on :
4
+ pull_request :
5
+
6
+ permissions :
7
+ pull-requests : write
8
+
9
+ jobs :
10
+ estimate :
11
+ runs-on : ubuntu-latest
12
+ container :
13
+ image : golang:1.19
14
+
15
+ steps :
16
+ - name : Check out code
17
+ uses : actions/checkout@v4
18
+ with :
19
+ repository : ' redhat-appstudio/qe-tools'
20
+ - name : Setup Go environment
21
+ uses : actions/setup-go@v5
22
+
23
+ - name : Run estimate time needed for PR review
24
+ run : |
25
+ go run main.go estimate-review \
26
+ --owner ${{ github.repository_owner }} \
27
+ --repository ${{ github.event.repository.name }} \
28
+ --number ${{ github.event.pull_request.number }} \
29
+ > result
30
+ cat result
31
+
32
+ - name : Add label based on review time
33
+ run : |
34
+ reviewTime=$(cat result)
35
+ label="< 1 min"
36
+ if [ ${reviewTime} -gt 3600 ]; then
37
+ label="> 60 min"
38
+ elif [ ${reviewTime} -gt 1800 ]; then
39
+ label="30-60 min"
40
+ elif [ ${reviewTime} -gt 900 ]; then
41
+ label="15-30 min"
42
+ elif [ ${reviewTime} -gt 600 ]; then
43
+ label="10-15 min"
44
+ elif [ ${reviewTime} -gt 300 ]; then
45
+ label="5-10 min"
46
+ elif [ ${reviewTime} -gt 60 ]; then
47
+ label="1-5 min"
48
+ fi
49
+
50
+ echo "Adding label: ${label}"
51
+ curl -s --fail-with-body -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
52
+ -H "Accept: application/vnd.github.v3+json" \
53
+ https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
54
+ -d "[\"${label}\"]"
You can’t perform that action at this time.
0 commit comments