🔧 USe color range for example badge

This commit is contained in:
Simon Schneegans
2022-04-18 13:55:29 +02:00
parent a3f7e7f029
commit 7ce4e745e5
2 changed files with 15 additions and 7 deletions

View File

@@ -15,7 +15,9 @@ jobs:
auth: ${{ secrets.GIST_SECRET }} auth: ${{ secrets.GIST_SECRET }}
gistID: 2ab8f1d386f13aaebccbd87dac94068d gistID: 2ab8f1d386f13aaebccbd87dac94068d
filename: answer.json filename: answer.json
label: The Answer is label: The Answer
message: ${{ env.ANSWER }} message: is ${{ env.ANSWER }}
color: green valColorRange: ${{ env.ANSWER }}
maxColorRange: 100
minColorRange: 0

View File

@@ -104,7 +104,11 @@ Parameter | Description
### Using Environment Variables as Parameters [![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/schneegans/2ab8f1d386f13aaebccbd87dac94068d/raw/answer.json)](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/schneegans/2ab8f1d386f13aaebccbd87dac94068d/raw/answer.json) ### Using Environment Variables as Parameters [![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/schneegans/2ab8f1d386f13aaebccbd87dac94068d/raw/answer.json)](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/schneegans/2ab8f1d386f13aaebccbd87dac94068d/raw/answer.json)
A common usage pattern of this action is to create environment variables in previous steps of a job and later use them as message in your badge. This can be achieved like this: A common usage pattern of this action is to create environment variables in previous steps of a job and later use them as message in your badge.
How this can be done, is shown in the following example.
This example also shows how to use the automatic color range feature: If the answer is <= 0, the badge will be red, if it's >= 100 it will be green.
For all values in between, the color will be interpolated.
```yml ```yml
- name: Get the Numbers - name: Get the Numbers
@@ -115,9 +119,11 @@ A common usage pattern of this action is to create environment variables in prev
auth: ${{ secrets.GIST_SECRET }} auth: ${{ secrets.GIST_SECRET }}
gistID: <gist-ID> gistID: <gist-ID>
filename: answer.json filename: answer.json
label: The Answer is label: The Answer
message: ${{ env.ANSWER }} message: is ${{ env.ANSWER }}
color: green valColorRange: ${{ env.ANSWER }}
maxColorRange: 100
minColorRange: 0
``` ```
## Contributing to Dynamic Badges Action ## Contributing to Dynamic Badges Action