Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsudaiki committed Jul 24, 2024
1 parent 41b85a9 commit ce630bc
Show file tree
Hide file tree
Showing 9 changed files with 1,230 additions and 1,060 deletions.
27 changes: 27 additions & 0 deletions .github/actions/badge/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Regular badging sequence
description: Publishes a badge based on the job status
inputs:
category:
description: The subfolder where to group the badges
required: true
badges:
description: A json object of label => status for all badges
required: true
github_token:
description: The token to use to publish the changes
required: false
default: ${{ github.token }}
runs:
using: composite
steps:
- run: |
node ./.github/actions/badge/write-json-object.js ${{ inputs.category }} '${{ inputs.badges }}'
shell: bash
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ inputs.github_token }}
publish_branch: badges
publish_dir: ./badges
keep_files: true
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
18 changes: 18 additions & 0 deletions .github/actions/badge/write-json-object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const fs = require('fs');
const category = process.argv[2];
const status = JSON.parse(process.argv[3]);

if (!fs.existsSync("./badges")) fs.mkdirSync("./badges");
if (!fs.existsSync("./badges/" + category)) fs.mkdirSync("./badges/" + category);
for (let e in status) {
const path = "./badges/" + category + "/" + e;
if (!fs.existsSync(path)) fs.mkdirSync(path);
const ok = status[e] == "success";
fs.writeFileSync(path + "/shields.json", JSON.stringify({
"schemaVersion": 1,
"label": e,
"message": ok ? "Passing" : "Failing",
"color": ok ? "brightgreen" : "red"
}));
}

Loading

0 comments on commit ce630bc

Please sign in to comment.