theme winter #6
This file contains 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: Automated theme submission | |
on: | |
issues: | |
types: [labeled] | |
jobs: | |
create_pr: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
contents: write | |
pull-requests: write | |
if: ${{ github.event.issue.state == 'open' && contains(github.event.issue.labels.*.name, 'new theme') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2.7.0 | |
- name: New branch | |
id: branch | |
run: | | |
git branch themes/${{ github.event.issue.number }} | |
git switch themes/${{ github.event.issue.number }} | |
echo "name=themes/${{ github.event.issue.number }}" >> "$GITHUB_OUTPUT" | |
- name: Read body | |
id: parse | |
uses: edumserrano/github-issue-forms-parser@v1 | |
with: | |
template-filepath: .github/ISSUE_TEMPLATE/new-theme.yml | |
issue-form-body: ${{ github.event.issue.body }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Make the change | |
run: | | |
node scripts/add-new-theme.cjs "$THEMEINFO" | |
echo '==============================' | |
cat themes.new.json | jq . | tee src/themes.json | |
env: | |
THEMEINFO: ${{ steps.parse.outputs.parsed-issue }} | |
- name: Configure Git | |
run: git config --global user.name "$GNAME" && git config --global user.email "$GEMAIL" | |
env: | |
GNAME: ${{ github.actor }} | |
GEMAIL: ${{ github.actor }}@users.noreply.github.com | |
- name: Commit | |
run: git add src/themes.json && git commit -m"Automated theme submission for issue #${{ github.event.issue.number }}" | |
- name: Push | |
run: git push -u origin ${{ steps.branch.outputs.name }} | |
- name: Create PR | |
id: pr | |
run: echo "url=$(gh pr create --title "$TITLE" --body "$BODY")" >> "$GITHUB_OUTPUT" | |
env: | |
TITLE: ${{ github.event.issue.title }} | |
BODY: ${{ github.event.issue.body }} | |
GH_TOKEN: ${{ github.token }} | |
- name: Close and comment on issue | |
run: | | |
gh issue close ${{ github.event.issue.number }} | |
gh issue comment ${{ github.event.issue.number }} --body \ | |
"Thanks for taking the time to submit a theme to Chess No. 25! \ | |
It's automatically converted to a pull request and you can [track it's status here](${{ steps.pr.outputs.url }}). \ | |
The theme should be checked in up to 5 days (may take even 2 months or longer sometimes)." |