mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 15:27:28 +00:00
* ci: Update node coverage badge to work without games.txt Fixes #155 using a new node script that should be more robust than the old shell script. * ci: Change badge cron time to less common time By doing at a less common time we should reduce action time usage as the runners will be under less load. * Add/Update badge * ci: Improve node-badge script Co-Authored-By: CosminPerRam <cosmin.p@live.com> * ci: Run node badge action if script changes * ci: Update node badge path for workspaces * ci: Revert loading games from index in node badge script --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: CosminPerRam <cosmin.p@live.com>
61 lines
1.8 KiB
YAML
61 lines
1.8 KiB
YAML
# Based on: https://github.com/emibcn/badge-action/blob/master/.github/workflows/test.yml
|
|
name: "Generate node comparison badge"
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- "crates/lib/src/games/definitions.rs"
|
|
- ".github/workflows/node-badge.yml"
|
|
- ".github/workflows/scripts/node-badge.mjs"
|
|
schedule:
|
|
- cron: '34 3 * * 2' # Update once a week in case node-gamedig has changed
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
badge:
|
|
runs-on: "ubuntu-latest"
|
|
name: Create node comparison badge
|
|
env:
|
|
BADGE_PATH: ".github/badges/node.svg"
|
|
steps:
|
|
- name: Extract branch name
|
|
shell: bash
|
|
run: echo "branch=${GITHUB_REF#refs/heads/}" >> "${GITHUB_OUTPUT}"
|
|
id: extract_branch
|
|
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
repository: "gamedig/node-gamedig"
|
|
path: "node-gamedig"
|
|
sparse-checkout: |
|
|
lib/games.js
|
|
package.json
|
|
|
|
- name: Calculate comparison
|
|
id: comparison
|
|
run: node .github/workflows/scripts/node-badge.mjs
|
|
|
|
- name: Generate the badge SVG image
|
|
uses: emibcn/badge-action@v2.0.2
|
|
id: badge
|
|
with:
|
|
label: "Node game coverage"
|
|
status: "${{ steps.comparison.outputs.percent }}%"
|
|
color: "0f80c1"
|
|
path: ${{ env.BADGE_PATH }}
|
|
|
|
- name: "Commit badge"
|
|
continue-on-error: true
|
|
run: |
|
|
git config --local user.email "action@github.com"
|
|
git config --local user.name "GitHub Action"
|
|
git add "${BADGE_PATH}"
|
|
git commit -m "Add/Update badge"
|
|
|
|
- name: Push badge commit
|
|
uses: ad-m/github-push-action@master
|
|
if: ${{ success() }}
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
branch: ${{ steps.extract_branch.outputs.branch }}
|