Create update-badge.yml

This commit is contained in:
Carlo Costanzo 2024-12-24 11:27:35 -05:00 committed by GitHub
parent 7ab77cbd5f
commit c1057f8499
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 40 additions and 0 deletions

40
.github/workflows/update-badge.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Update HA Version Badge
on:
push:
branches: [ "master" ] # If your default branch is "master", change this
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install Badgen
run: npm install -g badgen-cli
- name: Generate Badge
id: gen_badge
run: |
HA_VERSION=$(cat config/.HA_VERSION)
badgen "label=HA Version" "status=$HA_VERSION" "color=blue" > ha-version-badge.svg
echo "::set-output name=haVersion::$HA_VERSION"
- name: Commit and Push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add ha-version-badge.svg
# Only commit if there's a change
git diff --quiet --cached || git commit -m "Update HA version badge to ${{ steps.gen_badge.outputs.haVersion }}"
git push