Skip to content

Commit

Permalink
add link to badge
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxDall committed Jan 16, 2024
1 parent 65f34ee commit 302f057
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions .github/workflows/publisher_coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
with:
ref: ${{ github.head_ref }}

- name: Set up Python 3.9
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.8

- name: Install Fundus
run: pip install -e .
Expand Down Expand Up @@ -62,8 +62,8 @@ jobs:
echo "PASSED_PUBLISHERS=$(echo ${{ env.SUCCESS_RATE }} | grep -P -o '\d+' | head -1)" >> $GITHUB_ENV
- name: Get Red Threshold
# We set the badge colour to red when at least one publisher failed the tests.
run: echo "RED_THRESHOLD=$(( ${{ env.TOTAL_PUBLISHERS }} - 1 ))" >> $GITHUB_ENV
# We set the badge colour to red when at least half the publishers fail the tests.
run: echo "RED_THRESHOLD=$(( ${{ env.TOTAL_PUBLISHERS }} / 2 ))" >> $GITHUB_ENV

- name: Create Badge
uses: schneegans/dynamic-badges-action@v1.6.0
Expand All @@ -76,3 +76,36 @@ jobs:
valColorRange: ${{ env.PASSED_PUBLISHERS }}
maxColorRange: ${{ env.TOTAL_PUBLISHERS }}
minColorRange: ${{ env.RED_THRESHOLD }}

update_badge_json:
runs-on: ubuntu-latest
needs: create_badge

steps:
- name: Read gist
id: gist_content
uses: gorgbus/gist-actions@main
env:
GITHUB_TOKEN: ${{ secrets.DOBBERSC_GIST_SECRET }}
with:
action: "get"
gist_id: "ca0ae056b05cbfeaf30fa42f84ddf458"
file_name: "fundus_publisher_coverage.json"

- name: Change content
id: new_gist
uses: gorgbus/edit-json-string@main
with:
json_string: ${{ steps.gist_content.outputs.content }}
field: "link"
value: https://github.com/<username>/<repo_name>/actions/runs/${{ github.run_id }}

- name: Update gist
uses: gorgbus/gist-actions@main
env:
GITHUB_TOKEN: ${{ secrets.DOBBERSC_GIST_SECRET }}
with:
action: "update"
gist_id: "ca0ae056b05cbfeaf30fa42f84ddf458"
file_name: "fundus_publisher_coverage.json"
content: ${{ steps.new_gist.outputs.content }}

0 comments on commit 302f057

Please sign in to comment.