-
Notifications
You must be signed in to change notification settings - Fork 11
59 lines (56 loc) · 2.06 KB
/
issue-to-json.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
58
59
name: Convert Issues to JSON Data
on:
issues:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues
types:
- opened
- edited
- reopened
- labeled
jobs:
convert_to_config:
if: contains( github.event.issue.title, 'New Project Configuration' )
runs-on: ubuntu-latest
steps:
# This step checks out a copy of your repository.
- name: Check out repository
uses: actions/checkout@v4
- name: install dependencies
shell: bash -l {0}
run: |
npm install js-yaml
npm i @actions/core
npm i @actions/github
# This step references the directory that contains the action.
- name: Use local convertIssue action
uses: ./.github/actions/convertIssue
with:
# This controls where the JSON files are generated
folder: "configs/"
# This tells the action which GitHub Issue Form template file to use
issue-template: "add-new-config.yml"
# This controls which property we use to key the file name
hash-property-name: "url_abbreviation"
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add configs/
git commit -m "Creating or updating file from form in issue #${{ env.IssueNumber }}"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
add-paths: |
configs/
commit-message: Create or update a new config file
signoff: false
branch: new-config-#${{ env.IssueNumber }}
delete-branch: false
title: '[Config #${{ env.IssueNumber }}] create new file'
body: |
Adding a new config file
- Initialized by creating or updating the coressponding issue
- Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
draft: false