Sync Tag Type Definitions #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Tag Type Definitions | |
| on: | |
| # Run weekly on Monday at 00:00 UTC | |
| schedule: | |
| - cron: '0 0 * * 1' | |
| # Allow manual trigger | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| sync-tag-definitions: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Fetch tag type definitions from OpenEPaperLink | |
| id: fetch | |
| run: python3 scripts/fetch_tag_types.py new_tag_types.json | |
| - name: Generate updated const.py | |
| id: generate | |
| run: | | |
| python3 scripts/generate_tag_types.py new_tag_types.json | |
| rm -f new_tag_types.json | |
| - name: Close existing automated PR | |
| if: steps.generate.outputs.changed == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Find and close any existing open PRs on the automated branch | |
| existing_prs=$(gh pr list --repo "${{ github.repository }}" --head "automated/sync-tag-definitions" --state open --json number --jq '.[].number') | |
| for pr_number in $existing_prs; do | |
| echo "Closing existing PR #$pr_number" | |
| gh pr close "$pr_number" --repo "${{ github.repository }}" --comment "Superseded by a newer automated update." | |
| done | |
| - name: Create Pull Request | |
| if: steps.generate.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: 'Update tag type definitions from OpenEPaperLink' | |
| title: 'chore: Update tag type definitions from OpenEPaperLink' | |
| body: | | |
| This PR automatically updates the fallback tag type definitions to match the latest definitions from the OpenEPaperLink repository. | |
| ## Changes | |
| ${{ steps.generate.outputs.summary }} | |
| ## Source | |
| Definitions fetched from: https://github.com/OpenEPaperLink/OpenEPaperLink/tree/master/resources/tagtypes | |
| ## Notes | |
| - Only required fields are included: `version`, `name`, `width`, `height` | |
| - Optional fields (`bpp`, `rotatebuffer`) use defaults from TagType class | |
| --- | |
| *This PR was automatically created by the sync-tag-definitions workflow* | |
| branch: 'automated/sync-tag-definitions' | |
| delete-branch: true | |
| add-paths: | | |
| custom_components/opendisplay/const.py | |
| labels: | | |
| automated | |
| dependencies | |
| - name: Summary | |
| run: | | |
| if [ "${{ steps.generate.outputs.changed }}" == "true" ]; then | |
| echo "✅ Changes detected - PR created" | |
| echo "${{ steps.generate.outputs.summary }}" | |
| else | |
| echo "✅ No changes detected - definitions are up to date" | |
| fi |