Skip to content

Create Theme

Create Theme #13

Workflow file for this run

on:
issues:
types: [opened]
jobs:
createPR:
permissions: write-all
name: Submit a theme
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Parse issue
id: parse
uses: onmax/issue-form-parser@v1.5
with:
issue_number: ${{ github.event.issue.number }}
# Examples on how to use the output
- name: Show parsed payload data
run: |
# Using the character `'` to prevent all characters enclosed within
# them from being treated as special characters (e.g. $ or `)
echo '${{ steps.parse.outputs.payload }}'
- name: Export parsed payload into variables
id: export
run: |
echo "THEME_NAME='${{ fromJson(steps.parse.outputs.payload)['Name'] }}'" >> $GITHUB_ENV
echo "THEME_DESCRIPTION='${{ fromJson(steps.parse.outputs.payload)['Description'] }}'" >> $GITHUB_ENV
echo "THEME_HOMEPAGE='${{ fromJson(steps.parse.outputs.payload)['Homepage'] }}'" >> $GITHUB_ENV
echo "THEME_STYLES='${{ fromJson(steps.parse.outputs.payload)['Theme Styles'] }}'" >> $GITHUB_ENV
echo "THEME_README='${{ fromJson(steps.parse.outputs.payload)['Readme'] }}'" >> $GITHUB_ENV
echo "THEME_AUTHOR='${{ github.actor }}'" >> $GITHUB_ENV
- name: Setup Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Create theme content
run: |
python3 scripts/submit-theme.py \
--name "${THEME_NAME}" \
--description "${THEME_DESCRIPTION}" \
--homepage "${THEME_HOMEPAGE}" \
--styles "${THEME_STYLES}" \
--readme "${THEME_README}" \
--author "${THEME_AUTHOR}" 2> error.log
- name: Export creation output
if: failure()
run: |
echo "CREATION_OUTPUT=$(cat error.log)" >> $GITHUB_ENV
- name: Show error message
if: failure()
uses: peter-evans/close-issue@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment: |
# Error creating theme
Sorry about that! There was an error creating the theme. Please try again or contact the maintainers for help.
```
${{ env.CREATION_OUTPUT }}
```
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
if: success()
with:
add-paths: themes/
token: ${{ secrets.DEPLOY_KEY }}
commit-message: "Add theme: ${{ env.THEME_NAME }}"
delete-branch: true
title: "Add theme: ${{ env.THEME_NAME }}"
body: |
# Add theme: ${{ env.THEME_NAME }}
This PR adds a new theme to the theme library.
## Theme Details
* **Name**: ${{ env.THEME_NAME }}
* **Description**: ${{ env.THEME_DESCRIPTION }}
* **Homepage**: ${{ env.THEME_HOMEPAGE }}
* **Author**: @${{ env.THEME_AUTHOR }}
branch: create-theme-${{ github.event.issue.number }}
base: main
- if: startsWith(github.event.issue.title, '[create-theme]:') != 'true' && success()
name: Close Issue
uses: peter-evans/close-issue@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment: |
# Thank you for your contribution!
Your theme has been successfully submitted. The maintainers will review it and get back to you soon.
Here are some details about your submission:
* Your theme has been requested into [this PR](https://github.com/zen-browser/theme-store/pull/${{ steps.createPR.outputs.pull-request-url }})!
* It has been created into the [create-theme-${{ github.event.issue.number }} branch](https://github.com/zen-browser/theme-store/tree/create-theme-${{ github.event.issue.number }}).
> If you have any questions or need help, feel free to ask in the comments below or in the PR.