Skip to content

[Blueprint] Maniac #745

[Blueprint] Maniac

[Blueprint] Maniac #745

name: Create Blueprint from Issue
on:
issue_comment:
types: [ created ]
jobs:
create_blueprint_from_issue:
# Only run on Blueprint issues when I comment /create-blueprint
if: ${{ (!github.event.issue.pull_request) && (startsWith(github.event.issue.title, '[Blueprint]')) && (contains(github.event.comment.body, '/create-blueprint')) && (github.event.comment.user.login == 'CollinHeist') && !contains(github.event.issue.labels.*.name, 'created') }}
runs-on: ubuntu-latest
steps:
# Check out repository
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: refs/heads/staging
persist-credentials: false
fetch-depth: 0
# Run script to parse issue
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
- name: Parse Issue into Blueprint
env:
ISSUE_BODY: ${{ toJson(github.event.issue.body) }}
ISSUE_CREATOR: '${{ github.event.issue.user.login }}'
run: |
python entrypoint.py --parse-submission
- name: Run pytest
run: |
pytest ./src/tests/
# Commit changes
- name: Commit New Blueprint
run: |
git config --local user.email "action@github.com"
git config --local user.name "TitleCardMakerBot"
git add *
git diff-index --quiet HEAD || git commit -a -m "Create ${{ github.event.issue.user.login }}'s Blueprint #${{ github.event.issue.number }}"
git pull
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: refs/heads/staging
# Add label that Blueprint has been built
- name: Add Label
if: ${{ success() }}
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["created"]
})