[Blueprint] Sausage Party: Foodtopia #295
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: Create Set from Issue | |
on: | |
issue_comment: | |
types: [ created ] | |
jobs: | |
create_set_from_issue: | |
# Only run on Set issues when I comment /create-set | |
if: ${{ (!github.event.issue.pull_request) && (startsWith(github.event.issue.title, '[Set]')) && (contains(github.event.comment.body, '/create-set')) && (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 Set | |
env: | |
ISSUE_BODY: ${{ toJson(github.event.issue.body) }} | |
run: | | |
python entrypoint.py --parse-set-submission | |
- name: Run pytest | |
run: | | |
pytest ./src/tests/ | |
# Commit changes | |
- name: Commit New Set | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "TitleCardMakerBot" | |
git add * | |
git diff-index --quiet HEAD || git commit -a -m "Create ${{ github.event.issue.user.login }}'s Set #${{ 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 Set 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"] | |
}) |