From 33748372a209db75cb758fa7dbecfac6d9da53f7 Mon Sep 17 00:00:00 2001 From: Aaron Guise Date: Wed, 31 Jul 2024 11:59:13 +1200 Subject: [PATCH] =?UTF-8?q?fix:=20Make=20tests=20use=20action=20locally=20?= =?UTF-8?q?=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/badges.yml | 35 ++++++----------------------------- index.js | 7 +------ 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/.github/workflows/badges.yml b/.github/workflows/badges.yml index b5e5fe5..79dad94 100644 --- a/.github/workflows/badges.yml +++ b/.github/workflows/badges.yml @@ -13,32 +13,16 @@ jobs: - name: Get the Numbers run: echo "ANSWER=42" >> $GITHUB_ENV - name: Create the Badge - uses: schneegans/dynamic-badges-action@master + uses: https://hub.cybercinch.nz/cybercinch/dynamic-badges-action@master with: - auth: ${{ secrets.GIST_SECRET }} - gistID: 2ab8f1d386f13aaebccbd87dac94068d - filename: answer.json + auth: ${{ secrets.BADGE_API_TOKEN }} + host: https://badges.cybercinch.nz/cybercinch/dynamic-badges-action/answer label: The Answer message: is ${{ env.ANSWER }} valColorRange: ${{ env.ANSWER }} maxColorRange: 100 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: name: "Create Color Range Badges" runs-on: ubuntu-latest @@ -57,18 +41,11 @@ jobs: - 90 - 100 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" - uses: schneegans/dynamic-badges-action@master + uses: https://hub.cybercinch.nz/cybercinch/dynamic-badges-action@master with: - auth: ${{ secrets.GIST_SECRET }} - gistID: 2ab8f1d386f13aaebccbd87dac94068d - filename: color_badge_${{ matrix.total }}.json + auth: ${{ secrets.BADGE_API_TOKEN }} + host: https://badges.cybercinch.nz/cybercinch/dynamic-badges-action/color_badge_${{ matrix.total }} label: Coverage message: ${{ matrix.total }}% minColorRange: 50 diff --git a/index.js b/index.js index 04f2092..0090979 100644 --- a/index.js +++ b/index.js @@ -58,16 +58,11 @@ try { // and message attributes are always required. All others are optional and added to the // content object only if they are given to the action. let data = { + schemaVersion: 1, label: core.getInput("label"), 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. const color = core.getInput("color");