Skip to content

Moar Marshmallows

Moar Marshmallows #472

Workflow file for this run

name: PR from Issue
on:
issues:
types: [opened, reopened, edited]
concurrency: "main"
jobs:
pr_from_issue:
if: ${{ contains(github.event.issue.labels.*.name, 'add-mod') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: "20"
- uses: stefanbuck/github-issue-parser@v3
id: issue-parser
with:
template-path: .github/ISSUE_TEMPLATE/add-mod.yml
- name: Get local Mod Database file
id: local-mods
run: echo "mods_output=$(< ./mods.json sed ':a;N;$!ba;s/\n/ /g')" >> $GITHUB_ENV
- uses: pnpm/action-setup@v2
with:
version: 8.6.10
run_install: true
- name: Build
run: |
cd scripts
pnpm run build
- id: modify-mod-list
uses: ./actions/modify-mod-list
with:
out-file: mods.json
github-token: ${{ secrets.GITHUB_TOKEN }}
form: "${{ steps.issue-parser.outputs.jsonString }}"
mods: "${{ env.mods_output }}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: "${{steps.modify-mod-list.outputs.edited-existing-mod && 'Edit existing mod:' || 'Add new mod:'}} ${{fromJSON(steps.issue-parser.outputs.jsonString).uniqueName}}"
commit-message: "${{steps.modify-mod-list.outputs.edited-existing-mod && 'Edit existing mod:' || 'Add new mod:'}} ${{fromJSON(steps.issue-parser.outputs.jsonString).uniqueName}}"
body: "Closes #${{ github.event.issue.number }}\n${{fromJSON(steps.issue-parser.outputs.jsonString).repoUrl}}"
branch-suffix: random
delete-branch: true
token: ${{ secrets.GITHUB_TOKEN }}
committer: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
labels: "add-mod"