refactor(scripts): added compatibility layer with old prefs style, convert prefs to new style on theme rebuild (#424)

* refactor(scripts): replaced hyphens with underscores in script names

* test(rebuild_themes): debug logs

* Rebuild themes.json after theme submission

* refactor(rebuild_themes): added preferences loading

* fix(submit-pr): fixed dependencies

* debug(rebuild_themes): add pre print

* feature(rebuild_themes): save preferences to file

* feature(rebuild_themes): add ident

* Rebuild themes.json after theme submission

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Bryan Galdámez 2024-09-20 22:58:24 -06:00 committed by GitHub
parent 640f563c73
commit 80842c45a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 647 additions and 178 deletions

View file

@ -17,7 +17,7 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Setup python modules
run: |
pip3 install requests
@ -39,19 +39,19 @@ jobs:
echo "THEME_IS_COLOR_THEME=${{ contains(fromJson(steps.issue-parser.outputs.jsonString)['is-color-theme'], 'JSON Color Theme') }}" >> $GITHUB_ENV
- name: Write styles to file
uses: "DamianReeves/write-file-action@master"
uses: 'DamianReeves/write-file-action@master'
with:
contents: ${{ fromJson(steps.issue-parser.outputs.jsonString)['styles'] }}
path: theme-styles.css
- name: Write readme to file
uses: "DamianReeves/write-file-action@master"
uses: 'DamianReeves/write-file-action@master'
with:
contents: ${{ fromJson(steps.issue-parser.outputs.jsonString)['readme'] }}
path: theme-readme.md
- name: Write preferences to file
uses: "DamianReeves/write-file-action@master"
uses: 'DamianReeves/write-file-action@master'
if: fromJson(steps.issue-parser.outputs.jsonString)['preferences'] != ''
with:
contents: ${{ fromJson(steps.issue-parser.outputs.jsonString)['preferences'] }}
@ -64,7 +64,7 @@ jobs:
- name: Create theme content
run: |
python3 scripts/submit-theme.py \
python3 scripts/submit_theme.py \
--name "${{ env.THEME_NAME }}" \
--description "${{ env.THEME_DESCRIPTION }}" \
--author "${{ env.THEME_AUTHOR }}" \
@ -77,7 +77,7 @@ jobs:
run: |
cat error.log
echo "CREATION_OUTPUT=$(cat error.log)" >> $GITHUB_ENV
- name: Show error message
if: failure()
uses: peter-evans/close-issue@v3
@ -97,9 +97,9 @@ jobs:
add-paths: themes/
labels: staged
token: ${{ secrets.DEPLOY_KEY }}
commit-message: "Add theme: ${{ env.THEME_NAME }}"
commit-message: 'Add theme: ${{ env.THEME_NAME }}'
delete-branch: true
title: "Add theme: ${{ env.THEME_NAME }}"
title: 'Add theme: ${{ env.THEME_NAME }}'
body: |
# Add theme: ${{ env.THEME_NAME }}
@ -112,7 +112,7 @@ jobs:
* **Author**: @${{ env.THEME_AUTHOR }}
branch: create-theme-${{ github.event.issue.number }}
base: main
- name: Close Issue
uses: peter-evans/close-issue@v3
with:

View file

@ -3,7 +3,7 @@ on:
pull_request:
types: [closed]
workflow_dispatch:
jobs:
submitPR:
permissions: write-all
@ -18,6 +18,10 @@ jobs:
with:
python-version: '3.x'
- name: Setup python modules
run: |
pip3 install requests
- name: Setup Git
run: |
git config --global user.name "github-actions[bot]"
@ -25,13 +29,11 @@ jobs:
- name: Rebuild all themes
run: |
python3 scripts/rebuild-themes.py
python3 scripts/rebuild_themes.py
- name: Commit changes
run: |
git add themes.json
git add themes/*
git commit -m "Rebuild themes.json after theme submission"
git push