|
1 | | -name: Update build status |
| 1 | +# |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 3 | +# or more contributor license agreements. See the NOTICE file |
| 4 | +# distributed with this work for additional information |
| 5 | +# regarding copyright ownership. The ASF licenses this file |
| 6 | +# to you under the Apache License, Version 2.0 (the |
| 7 | +# "License"); you may not use this file except in compliance |
| 8 | +# with the License. You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, |
| 13 | +# software distributed under the License is distributed on an |
| 14 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | +# KIND, either express or implied. See the License for the |
| 16 | +# specific language governing permissions and limitations |
| 17 | +# under the License. |
| 18 | +# |
| 19 | + |
| 20 | +name: Update build status workflow |
2 | 21 |
|
3 | 22 | on: |
4 | 23 | schedule: |
@@ -37,14 +56,26 @@ jobs: |
37 | 56 | if (cr.name == "Build and test") { |
38 | 57 | const params = JSON.parse(cr.output.text) // text contains parameters to make request in JSON |
39 | 58 | const run = await github.request('GET /repos/{owner}/{repo}/actions/runs/{run_id}', params) |
40 | | - const response = await github.request('PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}', { |
41 | | - owner: context.repo.owner, |
42 | | - repo: context.repo.repo, |
43 | | - check_run_id: cr.id, |
44 | | - output: cr.output, |
45 | | - status: run.data.status, |
46 | | - conclusion: run.data.conclusion |
47 | | - }) |
| 59 | +
|
| 60 | + // Keep syncing the status of the checks |
| 61 | + if (run.data.status == "completed") { |
| 62 | + const response = await github.request('PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}', { |
| 63 | + owner: context.repo.owner, |
| 64 | + repo: context.repo.repo, |
| 65 | + check_run_id: cr.id, |
| 66 | + output: cr.output, |
| 67 | + status: run.data.status, |
| 68 | + conclusion: run.data.conclusion |
| 69 | + }) |
| 70 | + } else { |
| 71 | + const response = await github.request('PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}', { |
| 72 | + owner: context.repo.owner, |
| 73 | + repo: context.repo.repo, |
| 74 | + check_run_id: cr.id, |
| 75 | + output: cr.output, |
| 76 | + status: run.data.status, |
| 77 | + }) |
| 78 | + } |
48 | 79 |
|
49 | 80 | break |
50 | 81 | } |
|
0 commit comments