mirror of
https://github.com/zen-browser/theme-store.git
synced 2025-07-08 01:10:01 +02:00
chore: Update create-theme workflow to write styles and readme to separate files
This commit is contained in:
parent
f7711c3b57
commit
9f5c6ebd05
2 changed files with 36 additions and 8 deletions
20
.github/workflows/create-theme.yml
vendored
20
.github/workflows/create-theme.yml
vendored
|
@ -31,15 +31,19 @@ jobs:
|
||||||
echo "THEME_NAME=${{ fromJson(steps.issue-parser.outputs.jsonString)['name'] }}" >> $GITHUB_ENV
|
echo "THEME_NAME=${{ fromJson(steps.issue-parser.outputs.jsonString)['name'] }}" >> $GITHUB_ENV
|
||||||
echo "THEME_DESCRIPTION=${{ fromJson(steps.issue-parser.outputs.jsonString)['description'] }}" >> $GITHUB_ENV
|
echo "THEME_DESCRIPTION=${{ fromJson(steps.issue-parser.outputs.jsonString)['description'] }}" >> $GITHUB_ENV
|
||||||
echo "THEME_HOMEPAGE=${{ fromJson(steps.issue-parser.outputs.jsonString)['homepage'] }}" >> $GITHUB_ENV
|
echo "THEME_HOMEPAGE=${{ fromJson(steps.issue-parser.outputs.jsonString)['homepage'] }}" >> $GITHUB_ENV
|
||||||
|
echo "THEME_AUTHOR=${{ github.event.issue.user.login }}" >> $GITHUB_ENV
|
||||||
echo "Ouputing styles and readme"
|
|
||||||
cat <<THEME_CREATE_EOT >> theme-styles.css
|
|
||||||
${{ fromJson(steps.issue-parser.outputs.jsonString)['styles'] }}
|
|
||||||
THEME_CREATE_EOT
|
|
||||||
|
|
||||||
cat <<THEME_CREATE_EOT >> theme-readme.md
|
- name: Write styles to file
|
||||||
${{ fromJson(steps.issue-parser.outputs.jsonString)['readme'] }}
|
uses: "DamianReeves/write-file-action@master"
|
||||||
THEME_CREATE_EOT
|
with:
|
||||||
|
contents: ${{ fromJson(steps.issue-parser.outputs.jsonString)['styles'] }}
|
||||||
|
path: theme-styles.css
|
||||||
|
|
||||||
|
- name: Write readme to file
|
||||||
|
uses: "DamianReeves/write-file-action@master"
|
||||||
|
with:
|
||||||
|
contents: ${{ fromJson(steps.issue-parser.outputs.jsonString)['readme'] }}
|
||||||
|
path: theme-readme.md
|
||||||
|
|
||||||
- name: Setup Git
|
- name: Setup Git
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -3,6 +3,7 @@ import os
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
|
import sys
|
||||||
|
|
||||||
STYLES_FILE = "chrome.css"
|
STYLES_FILE = "chrome.css"
|
||||||
README_FILE = "readme.md"
|
README_FILE = "readme.md"
|
||||||
|
@ -30,6 +31,26 @@ def get_readme():
|
||||||
content = content[:-len("```")]
|
content = content[:-len("```")]
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
def validate_name(name):
|
||||||
|
if len(name) == 0:
|
||||||
|
print("Name is required.", file=sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
if len(name) > 20:
|
||||||
|
print("Name must be less than 50 characters.", file=sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
for char in name:
|
||||||
|
if not char.isalnum() and char != ' ':
|
||||||
|
print("Name must only contain letters, numbers, and spaces.", file=sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
def validate_description(description):
|
||||||
|
if len(description) == 0:
|
||||||
|
print("Description is required.", file=sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
if len(description) > 120:
|
||||||
|
print("Description must be less than 100 characters.", file=sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Submit a theme to the theme repo.')
|
parser = argparse.ArgumentParser(description='Submit a theme to the theme repo.')
|
||||||
parser.add_argument('--name', type=str, help='The theme to submit.')
|
parser.add_argument('--name', type=str, help='The theme to submit.')
|
||||||
|
@ -43,6 +64,9 @@ def main():
|
||||||
homepage = args.homepage
|
homepage = args.homepage
|
||||||
author = args.author
|
author = args.author
|
||||||
|
|
||||||
|
validate_name(name)
|
||||||
|
validate_description(description)
|
||||||
|
|
||||||
theme_id = create_theme_id()
|
theme_id = create_theme_id()
|
||||||
|
|
||||||
print("""
|
print("""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue