Skip to content

Commit 901c1e6

Browse files
committed
initial database and script files
1 parent a23e7cb commit 901c1e6

15 files changed

+6648
-1
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "Bug Report"
2+
description: "Report a bug with the contributions workflow."
3+
title: "Describe the bug"
4+
labels: ["bug"]
5+
body:
6+
- type: textarea
7+
id: bug_description
8+
attributes:
9+
label: "Describe the bug"
10+
placeholder: "Provide a clear description of the bug."
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: steps_to_reproduce
15+
attributes:
16+
label: "Steps to reproduce"
17+
placeholder: "List the steps to reproduce the issue."
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: expected_behavior
22+
attributes:
23+
label: "Expected behavior"
24+
placeholder: "Describe what you expected to happen."
25+
validations:
26+
required: true
27+
- type: textarea
28+
id: actual_behavior
29+
attributes:
30+
label: "Actual behavior"
31+
placeholder: "Describe what actually happened."
32+
validations:
33+
required: true
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "Feature Request"
2+
description: "Request a new feature or enhancement."
3+
title: "Describe the feature"
4+
labels: ["enhancement"]
5+
body:
6+
- type: textarea
7+
id: enhancement_description
8+
attributes:
9+
label: "Describe the feature or enhancement"
10+
placeholder: "Provide a clear description of the requested feature."
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: use_case
15+
attributes:
16+
label: "What is the use case?"
17+
placeholder: "Explain the problem this feature will solve."
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: alternatives
22+
attributes:
23+
label: "Alternatives considered"
24+
placeholder: "List any alternative solutions you’ve considered."
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: New Contribution
2+
description: Register a new contribution.
3+
labels: ["new-contribution"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thank you for your new contribution to Processing.
9+
10+
Please provide the URL to the library properties text file.
11+
For example, in your library release artifacts, if your library is called my_library, the file might be called my_library.txt.
12+
- type: input
13+
id: url
14+
attributes:
15+
label: properties_url
16+
description: URL of your properties text file, in your published release artifacts.
17+
placeholder: https://
18+
validations:
19+
required: true
20+
- type: markdown
21+
attributes:
22+
value: |
23+
Also provide the type of contribution. The allowed values are `library`, `examples`, `tool` or `mode`.
24+
- type: dropdown
25+
id: contribution_type
26+
attributes:
27+
label: contribution_type
28+
description: The type of contribution.
29+
options:
30+
- library
31+
- examples
32+
- tool
33+
- mode
34+
default: 0
35+
validations:
36+
required: true
37+
- type: markdown
38+
attributes:
39+
value: |
40+
Once you submit this form, the properties file found at the url will be parsed and validated.
41+
42+
The result of this validation will be added to this issue:
43+
* If the text file is valid, a pull request will be automatically created, adding your contribution to the repository.
44+
* If the text file is not valid, a comment with the error will be added to the issue. You will need to edit your properties file before the contribution can be added.

.github/workflows/issue_to_pr.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Issue to Pull Request
2+
on:
3+
issues:
4+
types:
5+
- opened
6+
- edited
7+
- reopened
8+
permissions:
9+
contents: write
10+
issues: write
11+
pull-requests: write
12+
13+
jobs:
14+
validate:
15+
if: contains(github.event.issue.labels.*.name, 'new-contribution')
16+
runs-on: ubuntu-latest
17+
outputs:
18+
props: ${{ steps.parseProps.outputs.props }}
19+
comment-id: ${{ steps.issueComment.outputs.comment-id }}
20+
steps:
21+
- name: Parse issue
22+
id: parseIssue
23+
uses: onmax/[email protected]
24+
with:
25+
issue_number: ${{ github.event.issue.number }}
26+
27+
- name: Checkout sources
28+
uses: actions/checkout@v4
29+
30+
- name: Setup Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: 3.x
34+
35+
- name: Install dependencies
36+
run: pip install -r requirements.txt
37+
38+
- name: Read and validate properties txt file
39+
id: parseProps
40+
run: >
41+
python -u scripts/parse_and_validate_properties_txt.py \
42+
${{ fromJson(steps.parseIssue.outputs.payload).contribution_type }} \
43+
"${{ fromJson(steps.parseIssue.outputs.payload).properties_url }}"
44+
45+
- name: add comment to issue
46+
id: issueComment
47+
uses: peter-evans/create-or-update-comment@v4
48+
with:
49+
issue-number: ${{ github.event.issue.number }}
50+
body: |
51+
Your properties file was successfully parsed.
52+
53+
- name: if failure, add comment to issue
54+
if: failure()
55+
uses: peter-evans/create-or-update-comment@v4
56+
with:
57+
issue-number: ${{ github.event.issue.number }}
58+
body: |
59+
There was an error in reading in your file and parsing it.
60+
61+
${{ steps.parseProps.outputs.error }}
62+
create-pr:
63+
needs: validate
64+
env:
65+
BRANCH_NAME: issue-${{ github.event.issue.number }}
66+
ISSUE_NUM: ${{ github.event.issue.number }}
67+
ISSUE_TITLE: ${{ github.event.issue.title }}
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Checkout sources
71+
uses: actions/checkout@v4
72+
73+
- name: Setup Python
74+
uses: actions/setup-python@v5
75+
with:
76+
python-version: 3.x
77+
78+
- name: Install dependencies
79+
run: pip install -r requirements.txt
80+
81+
- name: check if target branch exists
82+
id: branchExists
83+
uses: GuillaumeFalourd/branch-exists@v1
84+
with:
85+
branch: ${{ env.BRANCH_NAME }}
86+
87+
- name: delete target branch if exists
88+
if: steps.branchExists.outputs.exists == 'true'
89+
uses: dawidd6/action-delete-branch@v3
90+
with:
91+
github_token: ${{github.token}}
92+
branches: ${{ env.BRANCH_NAME }}
93+
94+
- name: create branch
95+
env:
96+
GH_TOKEN: ${{ github.token }}
97+
run: gh issue develop $ISSUE_NUM --name $BRANCH_NAME --checkout
98+
99+
- name: edit database
100+
run: |
101+
cd scripts
102+
python add_new_contribution_to_yaml.py '${{ needs.validate.outputs.props }}'
103+
104+
- name: commit changes
105+
uses: stefanzweifel/git-auto-commit-action@v5
106+
with:
107+
commit_message: new contribution from issue ${{ env.ISSUE_NUM }}
108+
branch: ${{ env.BRANCH_NAME }}
109+
add_options: '-u'
110+
111+
- name: Create pull request
112+
run: gh pr create -B main -H $BRANCH_NAME --title "new contribution issue $ISSUE_NUM" --body "${{github.event.issue.title }}"
113+
env:
114+
GH_TOKEN: ${{ github.token }}
115+
116+
- name: add comment to issue
117+
uses: peter-evans/create-or-update-comment@v4
118+
with:
119+
comment-id: ${{ needs.validate.outputs.comment-id }}
120+
body: |
121+
A pull request with your contribution has been successfully created.
122+
123+
124+
- name: if failure, add comment to issue
125+
if: failure()
126+
uses: peter-evans/create-or-update-comment@v4
127+
with:
128+
comment-id: ${{ needs.validate.outputs.comment-id }}
129+
body: |
130+
An error was encountered when adding your contribution.
131+
We will look into this issue as soon as possible.

.gitignore

Whitespace-only changes.

0 commit comments

Comments
 (0)