fix: Make tests use action locally 🐛
Some checks failed
Build Badges / Create Answer Badge (push) Failing after 2s
Build Badges / Create Color Range Badges (0) (push) Failing after 2s
Build Badges / Create Color Range Badges (10) (push) Failing after 2s
Build Badges / Create Color Range Badges (100) (push) Failing after 2s
Build Badges / Create Color Range Badges (20) (push) Failing after 2s
Build Badges / Create Color Range Badges (30) (push) Failing after 2s
Build Badges / Create Color Range Badges (40) (push) Failing after 2s
Build Badges / Create Color Range Badges (50) (push) Failing after 2s
Build Badges / Create Color Range Badges (60) (push) Failing after 2s
Build Badges / Create Color Range Badges (70) (push) Failing after 2s
Build Badges / Create Color Range Badges (80) (push) Failing after 2s
Build Badges / Create Color Range Badges (90) (push) Failing after 2s
Checks / Check REUSE (push) Successful in 6s

This commit is contained in:
2024-07-31 11:59:13 +12:00
parent b348384cf9
commit 33748372a2
2 changed files with 7 additions and 35 deletions

View File

@@ -13,32 +13,16 @@ jobs:
- name: Get the Numbers - name: Get the Numbers
run: echo "ANSWER=42" >> $GITHUB_ENV run: echo "ANSWER=42" >> $GITHUB_ENV
- name: Create the Badge - name: Create the Badge
uses: schneegans/dynamic-badges-action@master uses: https://hub.cybercinch.nz/cybercinch/dynamic-badges-action@master
with: with:
auth: ${{ secrets.GIST_SECRET }} auth: ${{ secrets.BADGE_API_TOKEN }}
gistID: 2ab8f1d386f13aaebccbd87dac94068d host: https://badges.cybercinch.nz/cybercinch/dynamic-badges-action/answer
filename: answer.json
label: The Answer label: The Answer
message: is ${{ env.ANSWER }} message: is ${{ env.ANSWER }}
valColorRange: ${{ env.ANSWER }} valColorRange: ${{ env.ANSWER }}
maxColorRange: 100 maxColorRange: 100
minColorRange: 0 minColorRange: 0
svg-badge:
name: Create SVG Badge
runs-on: ubuntu-latest
steps:
- name: Create the Badge
uses: schneegans/dynamic-badges-action@master
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 2ab8f1d386f13aaebccbd87dac94068d
filename: badge.svg
label: This is
message: an SVG badge
color: red
labelColor: blue
color-range-badges: color-range-badges:
name: "Create Color Range Badges" name: "Create Color Range Badges"
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -57,18 +41,11 @@ jobs:
- 90 - 90
- 100 - 100
steps: steps:
- name: "Stagger"
run: |
# Gist returns 500 if we try to update many files in the same gist all at once.
# Thanks to Ned Batchelder for this idea!
# https://nedbatchelder.com/blog/202209/making_a_coverage_badge.html
sleep $( expr ${{ matrix.total }} / 10 )
- name: "Make badge" - name: "Make badge"
uses: schneegans/dynamic-badges-action@master uses: https://hub.cybercinch.nz/cybercinch/dynamic-badges-action@master
with: with:
auth: ${{ secrets.GIST_SECRET }} auth: ${{ secrets.BADGE_API_TOKEN }}
gistID: 2ab8f1d386f13aaebccbd87dac94068d host: https://badges.cybercinch.nz/cybercinch/dynamic-badges-action/color_badge_${{ matrix.total }}
filename: color_badge_${{ matrix.total }}.json
label: Coverage label: Coverage
message: ${{ matrix.total }}% message: ${{ matrix.total }}%
minColorRange: 50 minColorRange: 50

View File

@@ -58,16 +58,11 @@ try {
// and message attributes are always required. All others are optional and added to the // and message attributes are always required. All others are optional and added to the
// content object only if they are given to the action. // content object only if they are given to the action.
let data = { let data = {
schemaVersion: 1,
label: core.getInput("label"), label: core.getInput("label"),
message: core.getInput("message"), message: core.getInput("message"),
}; };
const filename = core.getInput("filename");
const isSvgFile = filename.endsWith(".svg");
if (!isSvgFile) {
data.schemaVersion = 1;
}
// Compute the message color based on the given inputs. // Compute the message color based on the given inputs.
const color = core.getInput("color"); const color = core.getInput("color");