-
Notifications
You must be signed in to change notification settings - Fork 25
57 lines (50 loc) · 1.94 KB
/
pr-from-issue.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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"