From c1057f8499bfe0f7c8616116513d315c6110e7ba Mon Sep 17 00:00:00 2001 From: Carlo Costanzo <2160436+CCOSTAN@users.noreply.github.com> Date: Tue, 24 Dec 2024 11:27:35 -0500 Subject: [PATCH] Create update-badge.yml --- .github/workflows/update-badge.yml | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/update-badge.yml diff --git a/.github/workflows/update-badge.yml b/.github/workflows/update-badge.yml new file mode 100644 index 00000000..7a266546 --- /dev/null +++ b/.github/workflows/update-badge.yml @@ -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