|
1 | 1 | name: wiby
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - issue_comment: |
5 |
| - types: [ created ] |
| 4 | + pull_request: |
| 5 | + types: [ labeled ] |
6 | 6 |
|
7 | 7 | env:
|
8 | 8 | WIBY_CHECK_NAME: "wiby"
|
9 | 9 | WIBY_NODE_VERSION: 14
|
10 | 10 |
|
11 | 11 | jobs:
|
12 | 12 |
|
13 |
| - permissions: |
| 13 | + status: |
14 | 14 |
|
15 | 15 | runs-on: ubuntu-latest
|
16 | 16 |
|
17 |
| - if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, 'wiby ') && (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR') }} |
| 17 | + if: ${{ github.event.label.name == 'wiby test' }} |
| 18 | + |
| 19 | + outputs: |
| 20 | + in_progress: ${{ steps.checks_by_status.outputs.in_progress }} |
| 21 | + queued: ${{ steps.checks_by_status.outputs.queued }} |
| 22 | + completed: ${{ steps.checks_by_status.outputs.completed }} |
18 | 23 |
|
19 | 24 | steps:
|
20 |
| - - run: 'echo "Author association: ${{ github.event.comment.author_association }}"' |
| 25 | + - name: Get status |
| 26 | + |
| 27 | + with: |
| 28 | + route: GET /repos/:repository/commits/:ref/check-runs |
| 29 | + repository: ${{ github.event.repository.full_name }} |
| 30 | + ref: ${{ github.event.pull_request.head.sha }} |
| 31 | + mediaType: | |
| 32 | + previews: |
| 33 | + - antiope |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + id: pr_status |
| 37 | + |
| 38 | + - name: Count wiby status check by their status |
| 39 | + run: | |
| 40 | + jq -r '.check_runs | map(select(.name=="wiby")) | group_by(.status) | map("::set-output name=" + .[0].status + "::" + (length | tostring)) | join("\n")' << EOF |
| 41 | + ${{ steps.pr_status.outputs.data }} |
| 42 | + EOF |
| 43 | + id: checks_by_status |
21 | 44 |
|
22 | 45 | test:
|
23 | 46 |
|
24 | 47 | runs-on: ubuntu-latest
|
25 | 48 |
|
26 |
| - needs: permissions |
| 49 | + needs: status |
27 | 50 |
|
28 |
| - if: ${{ startsWith(github.event.comment.body, 'wiby test') }} |
| 51 | + if: ${{ !needs.status.outputs.in_progress && !needs.status.outputs.queued }} |
29 | 52 |
|
30 | 53 | steps:
|
31 | 54 |
|
32 | 55 | - name: Load PR
|
33 | 56 |
|
34 | 57 | with:
|
35 |
| - route: ${{ github.event.issue.pull_request.url }} |
| 58 | + route: ${{ github.event.pull_request.url }} |
36 | 59 | env:
|
37 | 60 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
38 | 61 | id: load_pr
|
@@ -119,9 +142,9 @@ jobs:
|
119 | 142 |
|
120 | 143 | runs-on: ubuntu-latest
|
121 | 144 |
|
122 |
| - needs: permissions |
| 145 | + needs: status |
123 | 146 |
|
124 |
| - if: ${{ startsWith(github.event.comment.body, 'wiby result') }} |
| 147 | + if: ${{ needs.status.outputs.in_progress }} |
125 | 148 |
|
126 | 149 | steps:
|
127 | 150 |
|
|
0 commit comments