|
25 | 25 | result: ${{ steps.check-ownership-membership.outputs.result == 'true' && steps.check-is-mergeable.outputs.result == 'true' }} |
26 | 26 | commit_sha: ${{ steps.check-is-mergeable.outputs.commit_sha }} |
27 | 27 | steps: |
| 28 | + - name: Reset integrated status |
| 29 | + run: | |
| 30 | + curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 31 | + https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \ |
| 32 | + -d '{"state":"pending","description":"Waiting for relevant checks to complete","context":"checks_integrated"}' |
| 33 | +
|
28 | 34 | - name: Check if running tests is allowed |
29 | 35 | id: check-ownership-membership |
30 | 36 | uses: actions/github-script@v6 |
@@ -225,3 +231,27 @@ jobs: |
225 | 231 | secrets.TESTMO_TOKEN, secrets.AWS_KEY_ID, secrets.AWS_KEY_VALUE, secrets.REMOTE_CACHE_USERNAME, secrets.REMOTE_CACHE_PASSWORD ) }} |
226 | 232 | vars: ${{ format('{{"AWS_BUCKET":"{0}","AWS_ENDPOINT":"{1}","REMOTE_CACHE_URL":"{2}","TESTMO_URL":"{3}","TESTMO_PROJECT_ID":"{4}"}}', |
227 | 233 | vars.AWS_BUCKET, vars.AWS_ENDPOINT, vars.REMOTE_CACHE_URL_YA, vars.TESTMO_URL, vars.TESTMO_PROJECT_ID ) }} |
| 234 | + |
| 235 | + update_integrated_status: |
| 236 | + runs-on: ubuntu-latest |
| 237 | + needs: build_and_test |
| 238 | + if: always() |
| 239 | + steps: |
| 240 | + - name: Gather required checks results |
| 241 | + shell: bash |
| 242 | + run: | |
| 243 | + successbuilds=$(curl -L -X GET -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 244 | + https://api.github.com/repos/${{github.repository}}/commits/${{github.event.pull_request.head.sha}}/status | \ |
| 245 | + jq -cr '.statuses | .[] | select(.state=="success") | select(.context | startswith("build_")) | .context' | \ |
| 246 | + wc -l ) |
| 247 | + if [[ $successbuilds == "3" ]];then |
| 248 | + integrated_status="success" |
| 249 | + else |
| 250 | + integrated_status="failure" |
| 251 | + fi |
| 252 | + curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 253 | + https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \ |
| 254 | + -d '{"state":"'$integrated_status'","description":"All checks completed","context":"checks_integrated"}' |
| 255 | +
|
| 256 | +
|
| 257 | + |
0 commit comments