Skip to content

Commit bf8e34a

Browse files
authored
Merge pull request #71 from hrshdhgd/empty-body
Empty body
2 parents 315ffed + 6dbefaa commit bf8e34a

File tree

4 files changed

+58
-36
lines changed

4 files changed

+58
-36
lines changed

.github/workflows/new-pr-java.yml

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# return false;
2727
# }
2828
# return issue.data.body.includes('Hey ontobot');
29-
29+
3030
# build:
3131
# needs: check
3232
# if: needs.check.outputs.phraseExists == 'true'
@@ -41,32 +41,37 @@
4141
# - name: Checkout main branch
4242
# uses: actions/checkout@v3
4343

44-
# - name: Set up Python ${{ matrix.python-version }}
45-
# uses: actions/setup-python@v3
44+
# - name: Return issue number
45+
# id: gh-script-issue
46+
# uses: actions/github-script@v6
4647
# with:
47-
# python-version: ${{ matrix.python-version }}
48-
49-
# - name: Return issue number and repository name
50-
# id: gh-script
48+
# # github-token: ${{ secrets.GH_TOKEN }}
49+
# script: |
50+
# const issue_number = context.issue.number
51+
# const repo = context.repo.owner+"/"+context.repo.repo
52+
# return issue_number
53+
54+
# - name: Return repository name
55+
# id: gh-script-repo
5156
# uses: actions/github-script@v6
5257
# with:
58+
# # github-token: ${{ secrets.GH_TOKEN }}
5359
# script: |
54-
# const issue_number = context.issue.number;
55-
# const repo = context.repo.owner + "/" + context.repo.repo;
56-
# return { issue_number, repo };
60+
# const repo = context.repo.owner+"/"+context.repo.repo
61+
# return repo
5762

5863
# - name: Set branch name
5964
# id: vars
6065
# run: |
61-
# echo "resource=src/ontology/cl-edit.owl" >> $GITHUB_ENV
62-
# echo "branch-name=kgcl_automation_"${{ steps.gh-script.outputs.issue_number }} >> $GITHUB_ENV
66+
# echo "resource=src/envo/envo-edit.owl" >> $GITHUB_ENV
67+
# echo "branch-name=kgcl_automation_"${{ steps.gh-script-issue.outputs.result }} >> $GITHUB_ENV
6368

6469
# - name: Get jar & enable plugin.
6570
# run: |
6671
# mkdir -p robot-plugins
6772
# wget https://github.com/gouttegd/kgcl-java/releases/download/kgcl-0.2.0/kgcl-robot-plugin-0.2.0.jar -O robot-plugins/kgcl.jar
6873
# echo "ROBOT_PLUGINS_DIRECTORY=$(pwd)/robot-plugins/" >> "$GITHUB_ENV"
69-
74+
7075
# - name: Install dependencies
7176
# run: |
7277
# pip install ontobot-change-agent
@@ -75,22 +80,24 @@
7580
# id: ochange
7681
# run: |
7782
# ochange process-issue ${{ env.resource }} \
78-
# -r ${{ steps.gh-script.outputs.repo }} \
79-
# -n ${{ steps.gh-script.outputs.issue_number }} \
83+
# -r ${{ steps.gh-script-repo.outputs.result }} \
84+
# -n ${{ steps.gh-script-issue.outputs.result }} \
8085
# -g ${{ secrets.GH_TOKEN }}
81-
## ! OR using standalone JAR file.
82-
## ! ochange process-issue ${{ env.resource }} \
83-
## ! -r ${{ steps.gh-script.outputs.repo }} \
84-
## ! -n ${{ steps.gh-script.outputs.issue_number }} \
85-
## ! -g ${{ secrets.GH_TOKEN }} \
86-
## ! -j kgcl-robot.jar
86+
# # ! OR using standalone JAR file.
87+
# # ! ochange process-issue ${{ env.resource }} \
88+
# # ! -r ${{ steps.gh-script-repo.outputs.result }} \
89+
# # ! -n ${{ steps.gh-script-issue.outputs.result }} \
90+
# # ! -g ${{ secrets.GH_TOKEN }} \
91+
# # ! -j kgcl-robot.jar
92+
8793
# - name: Clean-up
8894
# run: rm -rf robot-plugins
8995

9096
# - name: Create Pull Request
9197
# uses: peter-evans/create-pull-request@v5
9298
# if: ${{ env.PR_TITLE}}
9399
# with:
100+
# token: ${{ secrets.GH_TOKEN }}
94101
# branch-suffix: short-commit-hash
95102
# labels: Automated
96103
# author: ${{ env.ISSUE_CREATOR }} <${{ env.ISSUE_CREATOR }}@users.noreply.github.com>

.github/workflows/new-pr.yml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
# return issue.data.body.includes('Hey ontobot');
2929

3030
# build:
31+
# needs: check
32+
# if: needs.check.outputs.phraseExists == 'true'
3133
# runs-on: ${{ matrix.os }}
3234
# strategy:
3335
# matrix:
@@ -36,36 +38,46 @@
3638

3739
# steps:
3840
# - uses: actions/checkout@v3
39-
40-
# - name: Set up Python
41+
# - name: Set up Python ${{ matrix.python-version }}
4142
# uses: actions/setup-python@v3
4243
# with:
4344
# python-version: ${{ matrix.python-version }}
4445

45-
# - name: Get issue number and repository name
46-
# id: gh-script
46+
# - name: Return issue number
47+
# id: gh-script-issue
48+
# uses: actions/github-script@v6
49+
# with:
50+
# # github-token: ${{ secrets.GH_TOKEN }}
51+
# script: |
52+
# const issue_number = context.issue.number
53+
# const repo = context.repo.owner+"/"+context.repo.repo
54+
# return issue_number
55+
56+
# - name: Return repository name
57+
# id: gh-script-repo
4758
# uses: actions/github-script@v6
4859
# with:
60+
# # github-token: ${{ secrets.GH_TOKEN }}
4961
# script: |
50-
# const issue_number = context.issue.number;
51-
# const repo = context.repo.owner+"/"+context.repo.repo;
52-
# return {issue_number, repo};
62+
# const repo = context.repo.owner+"/"+context.repo.repo
63+
# return repo
5364

54-
# - name: Set environment variables
65+
# - name: Set branch name
5566
# id: vars
5667
# run: |
5768
# echo "resource=src/ontology/mondo-edit.obo" >> $GITHUB_ENV
58-
# echo "branch-name=ochange_automation_"${{ steps.gh-script.outputs.result.issue_number }} >> $GITHUB_ENV
69+
# echo "branch-name=ochange_automation_"${{ steps.gh-script-issue.outputs.result }} >> $GITHUB_ENV
5970

6071
# - name: Install dependencies
61-
# run: pip install ontobot-change-agent
72+
# run: |
73+
# pip install ontobot-change-agent
6274

6375
# - name: Run ochange
6476
# id: ochange
6577
# run: |
6678
# ochange process-issue ${{ env.resource }} \
67-
# -r ${{ steps.gh-script.outputs.result.repo }} \
68-
# -n ${{ steps.gh-script.outputs.result.issue_number }} \
79+
# -r ${{ steps.gh-script-repo.outputs.result }} \
80+
# -n ${{ steps.gh-script-issue.outputs.result }} \
6981
# -g ${{ secrets.GH_TOKEN }}
7082
# -p XXXX
7183

@@ -79,3 +91,4 @@
7991
# title: ${{ env.PR_TITLE }}
8092
# base: ${{ github.head_ref }}
8193
# branch: ${{ env.branch-name }}
94+
# # token: ${{ secrets.GH_TOKEN }}

src/ontobot_change_agent/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def _make_sense_of_body(body: str) -> str:
122122
# return (
123123
# body.lstrip(bullet).replace("<", "").replace(">", "").split(splitter)
124124
# )
125-
return body.replace("<", "").replace(">", "")
125+
return body.replace("<", "").replace(">", "") if body else body
126126

127127

128128
def get_all_labels_from_repo(repository_name: str, token: str = None) -> dict:

src/ontobot_change_agent/cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def process_issue(
185185
repository_name=repo, token=token, label=label, number=number, state=state
186186
):
187187
# Make sure ontobot_change_agent needs to be triggered or no.
188-
if issue:
188+
if issue and issue[BODY]:
189189
KGCL_COMMANDS = []
190190
if NEW_TERM_LABEL in issue["labels"]:
191191
formatted_body = "The following input was provided: </br> "
@@ -218,7 +218,9 @@ def process_issue(
218218
else:
219219
click.echo(f"""{issue[TITLE]} does not need ontobot's attention.""")
220220
else:
221-
click.echo(f"""Issue number:{number} is either closed or does not exist.""")
221+
click.echo(
222+
f"""Issue number:{number} is either closed, does not exist or has no body."""
223+
)
222224
break
223225

224226
new_output = output if output else input

0 commit comments

Comments
 (0)