Skip to content

Commit 7698896

Browse files
authored
SONARPY-1978 Change CI Releasability checks to always be green allowing us to see the status by looking at the text (#1851)
1 parent 0370a28 commit 7698896

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

.github/workflows/releasability.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,36 @@ jobs:
2222
github.event.check_suite.conclusion == 'success' &&
2323
github.event.check_suite.app.slug == 'cirrus-ci')
2424
steps:
25-
- uses: >-
26-
SonarSource/gh-action_releasability/[email protected]
25+
- uses: SonarSource/gh-action_releasability/[email protected]
2726
env:
2827
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
2928
continue-on-error: true
29+
30+
- name: Check current status
31+
id: check_status
32+
uses: octokit/[email protected]
33+
with:
34+
route: GET /repos/${{ github.repository }}/commits/${{ github.sha }}/status
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Extract status information
39+
id: extract_info
40+
run: |
41+
status_info=$(echo '${{ steps.check_status.outputs.data }}' | jq -r '.statuses[] | select(.context == "Releasability") | {description: .description, target_url: .target_url}')
42+
description=$(echo "$status_info" | jq -r '.description')
43+
target_url=$(echo "$status_info" | jq -r '.target_url')
44+
echo "::set-output name=description::$description"
45+
echo "::set-output name=target_url::$target_url"
46+
47+
- name: Update status to success
48+
if: fromJson(steps.check_status.outputs.data).state != 'success'
49+
uses: octokit/[email protected]
50+
with:
51+
route: POST /repos/${{ github.repository }}/statuses/${{ github.sha }}
52+
state: "success"
53+
target_url: "${{ steps.extract_info.outputs.target_url }}"
54+
description: "${{ steps.extract_info.outputs.description }} (status rewritten)"
55+
context: "Releasability"
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)