🏷️ Create re-useable 'make badge' action (#126)

This commit is contained in:
Chris Mc
2021-01-27 22:39:56 -05:00
committed by GitHub
parent a735398ca8
commit 594dcf437e
2 changed files with 34 additions and 6 deletions

24
.github/actions/badge/action.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: Make a Basge
description: Creates a JSON file for use with Sheilds.io. The default is a "brightgreen" "Passing" badge
inputs:
category:
description: The subfolder where to group the badges
required: true
label:
description: The label to you in the badge (this should be unqie for each badge in a category)
required: true
message:
description: The message you wish to have in the badge
required: false
default: "Passing"
color:
description: The color you wish the badge to be
required: false
default: "brightgreen"
runs:
using: composite
steps:
- run: |
mkdir -p badges/${{ inputs.category }}/${{ inputs.label }}
echo '{ "schemaVersion": 1, "label": "${{ inputs.label }}", "message": "${{ inputs.message }}", "color": "${{ inputs.color }}" }' > badges/${{ inputs.category }}/${{ inputs.label }}/shields.json
shell: bash

View File

@@ -36,15 +36,19 @@ jobs:
- name: badge success
if: github.event_name == 'push' && success()
run: |
mkdir -p badges/libressl/${{ matrix.libressl }}
echo '{ "schemaVersion": 1, "label": "${{ matrix.libressl }}", "message": "Passing", "color": "brightgreen" }' > badges/libressl/${{ matrix.libressl }}/shields.json
uses: ./.github/actions/badge
with:
category: libressl
label: ${{ matrix.libressl }}
- name: badge failure
if: github.event_name == 'push' && !success()
run: |
mkdir -p badges/libressl/${{ matrix.libressl }}
echo '{ "schemaVersion": 1, "label": "${{ matrix.libressl }}", "message": "Failing", "color": "red" }' > badges/libressl/${{ matrix.libressl }}/shields.json
uses: ./.github/actions/badge
with:
category: libressl
label: ${{ matrix.libressl }}
message: Failing
color: red
- name: badge publish
if: github.event_name == 'push'