Skip to content

Commit 5b4a84b

Browse files
authored
Merge pull request #50 from Stefterv/main
Further simplification
2 parents 7ff846f + 4a203e5 commit 5b4a84b

File tree

1 file changed

+15
-29
lines changed

1 file changed

+15
-29
lines changed

.github/workflows/issue_to_pr.yml

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ permissions:
1212

1313
jobs:
1414
validate:
15+
name: Validate .properties File and Create a submission Pull Request
1516
# Only run this job if the issue has the 'new contribution' label
1617
if: contains(github.event.issue.labels.*.name, 'new contribution')
1718
runs-on: ubuntu-latest
18-
outputs:
19-
props: ${{ steps.parseProps.outputs.props }}
20-
comment-id: ${{ steps.issueComment.outputs.comment-id }}
19+
env:
20+
BRANCH_NAME: issue-${{ github.event.issue.number }}
21+
ISSUE_NUM: ${{ github.event.issue.number }}
22+
ISSUE_TITLE: ${{ github.event.issue.title }}
2123
steps:
2224
- name: Parse issue
2325
id: parseIssue
@@ -48,6 +50,7 @@ jobs:
4850
4951
- name: add comment to issue
5052
id: issueComment
53+
if: success()
5154
uses: peter-evans/create-or-update-comment@v4
5255
with:
5356
issue-number: ${{ github.event.issue.number }}
@@ -65,26 +68,6 @@ jobs:
6568
Please ensure that the URL is correct and the file follows the required format.
6669
6770
${{ steps.parseProps.outputs.error }}
68-
create-pr:
69-
# Only run this job if the issue has the 'new contribution' label
70-
if: contains(github.event.issue.labels.*.name, 'new contribution')
71-
needs: validate
72-
env:
73-
BRANCH_NAME: issue-${{ github.event.issue.number }}
74-
ISSUE_NUM: ${{ github.event.issue.number }}
75-
ISSUE_TITLE: ${{ github.event.issue.title }}
76-
runs-on: ubuntu-latest
77-
steps:
78-
- name: Checkout sources
79-
uses: actions/checkout@v4
80-
81-
- name: Setup Python
82-
uses: actions/setup-python@v5
83-
with:
84-
python-version: 3.x
85-
86-
- name: Install dependencies
87-
run: pip install -r requirements.txt
8871
8972
- name: check if target branch exists
9073
id: branchExists
@@ -107,24 +90,27 @@ jobs:
10790
- name: edit database
10891
run: |
10992
cd scripts
110-
python add_new_contribution_to_yaml.py '${{ needs.validate.outputs.props }}'
93+
python add_new_contribution_to_yaml.py '${{ steps.parseProps.outputs.props }}'
11194
11295
- name: commit changes
11396
uses: stefanzweifel/git-auto-commit-action@v5
11497
with:
115-
commit_message: new contribution from issue ${{ env.ISSUE_NUM }}
98+
commit_message: adding contribution ${{ github.event.issue.title }} from #${{ github.event.issue.number }}
11699
branch: ${{ env.BRANCH_NAME }}
117100
add_options: '-u'
118101

119102
- name: Create pull request
120-
run: gh pr create -B main -H $BRANCH_NAME --title "new contribution issue $ISSUE_NUM" --body "${{github.event.issue.title }}"
103+
run: |
104+
gh pr create -B main -H $BRANCH_NAME --title "Adding ${{ github.event.issue.title }}" --body "This pull request will add ${{ github.event.issue.title }}
105+
106+
and it closes \#${{ github.event.issue.number }}"
121107
env:
122108
GH_TOKEN: ${{ github.token }}
123109

124110
- name: add comment to issue
125111
uses: peter-evans/create-or-update-comment@v4
126112
with:
127-
comment-id: ${{ needs.validate.outputs.comment-id }}
113+
comment-id: ${{ steps.issueComment.outputs.comment-id }}
128114
body: |
129115
A pull request with your contribution has been successfully created.
130116
@@ -133,8 +119,8 @@ jobs:
133119
if: failure()
134120
uses: peter-evans/create-or-update-comment@v4
135121
with:
136-
comment-id: ${{ needs.validate.outputs.comment-id }}
122+
comment-id: ${{ steps.issueComment.outputs.comment-id }}
137123
body: |
138124
An error was encountered when adding your contribution.
139125
140-
We will look into this issue as soon as possible. Please check the details of your submission and try again if necessary.
126+
We will look into this issue as soon as possible. Please check the details of your submission and try again if necessary.

0 commit comments

Comments
 (0)