Skip to content

custom test badge

custom test badge #9

Workflow file for this run

name: test
on:
pull_request:
branches:
- '**'
push:
branches:
- 'main'
jobs:
test:
name: test
runs-on: ubuntu-latest
outputs:
epoch: ${{steps.test.outputs.epoch}}
tick: ${{steps.test.outputs.tick}}
status: ${{steps.test.outputs.status}}
color: ${{steps.test.outputs.color}}
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: sudo apt-get install -y xsltproc
- run: bun install --verbose
- id: test
run: PEERS="${{secrets.PEERS}}" SEED="${{secrets.SEED}}" bun test-ci.js
badge:
runs-on: ubuntu-latest
needs: test
if: ${{ always() }}
steps:
- name: Create badges dir
run: mkdir -p '.github/badges/'
# Use the output from the `coverage` step
- name: Generate badge svg
uses: emibcn/badge-action@v2.0.3
id: badge
with:
label: "${{needs.test.outputs.epoch}} | ${{needs.test.outputs.tick}}"
status: ${{needs.test.outputs.status}}
color: ${{needs.test.outputs.color}}
path: './github/badges/test.svg'
- name: Upload badge as artifact
uses: actions/upload-artifact@v4
with:
name: badge
path: './github/badges/test.svg'
if-no-files-found: error
- uses: actions/checkout@v4
continue-on-error: true
- run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add "./github/badges/test.svg"
git commit -m "Add/Update badge"
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "generated test badge"
git push