mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Add workflow to sync device classes with HA dev (#4629)
This commit is contained in:
		
							
								
								
									
										60
									
								
								.github/workflows/sync-device-classes.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								.github/workflows/sync-device-classes.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | |||||||
|  | --- | ||||||
|  | name: Synchronise Device Classes from Home Assistant | ||||||
|  |  | ||||||
|  | on: | ||||||
|  |   workflow_dispatch: | ||||||
|  |   schedule: | ||||||
|  |     - cron: '45 6 * * *' | ||||||
|  |  | ||||||
|  | permissions: | ||||||
|  |   contents: write | ||||||
|  |   pull-requests: write | ||||||
|  |  | ||||||
|  | jobs: | ||||||
|  |   sync: | ||||||
|  |     name: Sync Device Classes | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     steps: | ||||||
|  |       - name: Checkout | ||||||
|  |         uses: actions/checkout@v3 | ||||||
|  |  | ||||||
|  |       - name: Checkout Home Assistant | ||||||
|  |         uses: actions/checkout@v3 | ||||||
|  |         with: | ||||||
|  |           repository: home-assistant/core | ||||||
|  |           path: home-assistant | ||||||
|  |  | ||||||
|  |       - name: Setup Python | ||||||
|  |         uses: actions/setup-python@v4 | ||||||
|  |         with: | ||||||
|  |           python-version: 3.11 | ||||||
|  |  | ||||||
|  |       - name: Install Home Assistant | ||||||
|  |         run: | | ||||||
|  |           python -m pip install --upgrade pip | ||||||
|  |           pip install -e home-assistant | ||||||
|  |  | ||||||
|  |       - name: Sync | ||||||
|  |         run: | | ||||||
|  |           python ./script/sync-device_class.py | ||||||
|  |  | ||||||
|  |       - name: Get PR template | ||||||
|  |         id: pr-template-body | ||||||
|  |         run: | | ||||||
|  |           body=$(cat .github/PULL_REQUEST_TEMPLATE.md) | ||||||
|  |           delimiter="$(openssl rand -hex 8)" | ||||||
|  |           echo "body<<$delimiter" >> $GITHUB_OUTPUT | ||||||
|  |           echo "$body" >> $GITHUB_OUTPUT | ||||||
|  |           echo "$delimiter" >> $GITHUB_OUTPUT | ||||||
|  |  | ||||||
|  |       - name: Commit changes | ||||||
|  |         uses: peter-evans/create-pull-request@v4 | ||||||
|  |         with: | ||||||
|  |           commit-message: "Synchronise Device Classes from Home Assistant" | ||||||
|  |           committer: esphomebot <esphome@nabucasa.com> | ||||||
|  |           author: esphomebot <esphome@nabucasa.com> | ||||||
|  |           branch: sync/device-classes/ | ||||||
|  |           branch-suffix: timestamp | ||||||
|  |           delete-branch: true | ||||||
|  |           title: "Synchronise Device Classes from Home Assistant" | ||||||
|  |           body: ${{ steps.pr-template-body.outputs.body }} | ||||||
		Reference in New Issue
	
	Block a user