--- name: Synchronise Device Classes from Home Assistant on: workflow_dispatch: schedule: - cron: "45 6 * * *" # Repo writes (branch push, PR open) happen via the App token minted below, # so the workflow's GITHUB_TOKEN does not need any write scopes. permissions: contents: read # actions/checkout for this repo and home-assistant/core jobs: sync: name: Sync Device Classes runs-on: ubuntu-latest if: github.repository == 'esphome/esphome' steps: - name: Generate a token id: generate-token uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 with: client-id: ${{ vars.ESPHOME_GITHUB_APP_CLIENT_ID }} private-key: ${{ secrets.ESPHOME_GITHUB_APP_PRIVATE_KEY }} # Scope the minted App token to the minimum needed by peter-evans/create-pull-request. permission-contents: write # git.createCommit + refs.create/update to push the sync/device-classes branch permission-pull-requests: write # pulls.create / pulls.update to open or refresh the sync PR - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Checkout Home Assistant uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: repository: home-assistant/core path: lib/home-assistant - name: Setup Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: "3.14" - name: Install Home Assistant run: | python -m pip install --upgrade pip pip install -e lib/home-assistant pip install -r requirements_test.txt pre-commit - name: Sync run: | python ./script/sync-device_class.py - name: Run pre-commit hooks run: | python script/run-in-env.py pre-commit run --all-files - name: Commit changes uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 with: commit-message: "Synchronise Device Classes from Home Assistant" committer: esphomebot author: esphomebot branch: sync/device-classes delete-branch: true title: "Synchronise Device Classes from Home Assistant" body-path: .github/PULL_REQUEST_TEMPLATE.md token: ${{ steps.generate-token.outputs.token }}