Add body with update information to frontend update prs (#5691)

Overwrite the default body with useful version update information and
a link to the new release.

Also rename the title and use lower caps for local shell variables.
This commit is contained in:
Stefan Agner 2025-02-28 11:57:30 +01:00 committed by GitHub
parent a8cc3ae6ef
commit cf5a0dc548
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,7 +10,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
skip: ${{ steps.check_version.outputs.skip || steps.check_existing_pr.outputs.skip }} skip: ${{ steps.check_version.outputs.skip || steps.check_existing_pr.outputs.skip }}
latest_tag: ${{ steps.latest_frontend_version.outputs.latest_tag }} current_version: ${{ steps.check_version.outputs.current_version }}
latest_version: ${{ steps.latest_frontend_version.outputs.latest_tag }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -23,11 +24,11 @@ jobs:
- name: Check if version is up to date - name: Check if version is up to date
id: check_version id: check_version
run: | run: |
SUPERVISOR_VERSION=$(cat .ha-frontend-version) current_version="$(cat .ha-frontend-version)"
LATEST_VERSION=${{ steps.latest_frontend_version.outputs.latest_tag }} latest_version="${{ steps.latest_frontend_version.outputs.latest_tag }}"
echo "SUPERVISOR_VERSION=$SUPERVISOR_VERSION" >> $GITHUB_ENV echo "current_version=${current_version}" >> $GITHUB_OUTPUT
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV echo "LATEST_VERSION=${latest_version}" >> $GITHUB_ENV
if [[ ! "$SUPERVISOR_VERSION" < "$LATEST_VERSION" ]]; then if [[ ! "$current_version" < "$latest_version" ]]; then
echo "Frontend version is up to date" echo "Frontend version is up to date"
echo "skip=true" >> $GITHUB_OUTPUT echo "skip=true" >> $GITHUB_OUTPUT
fi fi
@ -37,7 +38,7 @@ jobs:
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
run: | run: |
PR=$(gh pr list --state open --base main --json title --search "Autoupdate frontend to version $LATEST_VERSION") PR=$(gh pr list --state open --base main --json title --search "Update frontend to version $LATEST_VERSION")
if [[ "$PR" != "[]" ]]; then if [[ "$PR" != "[]" ]]; then
echo "Skipping - There is already a PR open for version $LATEST_VERSION" echo "Skipping - There is already a PR open for version $LATEST_VERSION"
echo "skip=true" >> $GITHUB_OUTPUT echo "skip=true" >> $GITHUB_OUTPUT
@ -54,21 +55,26 @@ jobs:
rm -rf supervisor/api/panel/* rm -rf supervisor/api/panel/*
- name: Update version file - name: Update version file
run: | run: |
echo "${{ needs.check-version.outputs.latest_tag }}" > .ha-frontend-version echo "${{ needs.check-version.outputs.latest_version }}" > .ha-frontend-version
- name: Download release assets - name: Download release assets
uses: robinraju/release-downloader@v1 uses: robinraju/release-downloader@v1
with: with:
repository: 'home-assistant/frontend' repository: 'home-assistant/frontend'
tag: ${{ needs.check-version.outputs.latest_tag }} tag: ${{ needs.check-version.outputs.latest_version }}
fileName: home_assistant_frontend_supervisor-${{ needs.check-version.outputs.latest_tag }}.tar.gz fileName: home_assistant_frontend_supervisor-${{ needs.check-version.outputs.latest_version }}.tar.gz
extract: true extract: true
out-file-path: supervisor/api/panel/ out-file-path: supervisor/api/panel/
- name: Create PR - name: Create PR
uses: peter-evans/create-pull-request@v7 uses: peter-evans/create-pull-request@v7
with: with:
commit-message: "Autoupdate frontend to version ${{ needs.check-version.outputs.latest_tag }}" commit-message: "Update frontend to version ${{ needs.check-version.outputs.latest_version }}"
branch: autoupdate-frontend branch: autoupdate-frontend
base: main base: main
draft: true draft: true
sign-commits: true sign-commits: true
title: "Autoupdate frontend to version ${{ needs.check-version.outputs.latest_tag }}" title: "Update frontend to version ${{ needs.check-version.outputs.latest_version }}"
body: >
Update frontend from ${{ needs.check-version.outputs.current_version }} to
[${{ needs.check-version.outputs.latest_version }}]
(https://github.com/home-assistant/frontend/releases/tag/${{ needs.check-version.outputs.latest_version }})