Skip to content

Commit

Permalink
ci: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MarleneJiang committed Aug 16, 2023
1 parent c06f510 commit 902260e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .github/actions_scripts/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,21 @@ def main()->None:
print("开始解析")
try:
title = os.environ["TITLE"]
print("title:",title)
except KeyError:
set_multiline_output("result", "error")
set_multiline_output("output", "Missing required input `TITLE`.")
return
try:
pypi_name = os.environ["PYPI_NAME"]
print("pypi_name:",pypi_name)
except KeyError:
set_multiline_output("result", "error")
set_multiline_output("output", "Missing required input `PYPI_NAME`.")
return
try:
parsed = parse_title(title)
print("parsed:",parsed)
except ValueError as e:
set_multiline_output("result", "error")
set_multiline_output("output", str(e))
Expand All @@ -76,6 +79,7 @@ def main()->None:
set_multiline_output("result", "error")
set_multiline_output("output", "输入的pypi_name存在问题")
return
print("解析成功~")
set_multiline_output("result", "sucess")
set_multiline_output("output", "")
set_multiline_output("type", parsed.get("type",""))
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
ISSUE_NUM: ${{ github.event.issue.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}
outputs:
module_name: ${{ steps.set-output-module.outputs.module_name }}
pypi_name: ${{ steps.set-output-pypi.outputs.pypi_name }}
module_name: ${{ steps.set-output.outputs.module_name }}
pypi_name: ${{ steps.set-output.outputs.pypi_name }}
result: ${{ steps.run.outputs.result }}
output: ${{ steps.run.outputs.output }}
type: ${{ steps.run.outputs.type }}
Expand All @@ -68,19 +68,13 @@ jobs:
id: parse
uses: zentered/issue-forms-body-parser@v1.5.1

- name: Get Module Input
id: set-output-module
- name: Get Inputs
id: set-output
env:
JSON_DATA: ${{ steps.parse.outputs.data }}
run: |
module_name=$(echo $JSON_DATA | jq -r '.["module-name"].text' )
echo "module_name=$module_name" >> $GITHUB_OUTPUT
- name: Get Pypi Input
id: set-output-pypi
env:
JSON_DATA: ${{ steps.parse.outputs.data }}
run: |
pypi_name=$(echo $JSON_DATA | jq -r '.["pypi-name"].text' )
echo "pypi_name=$pypi_name" >> $GITHUB_OUTPUT
Expand All @@ -98,7 +92,7 @@ jobs:
id: run
env:
TITLE: ${{ env.ISSUE_TITLE }}
PYPI_NAME: ${{ steps.set-output-pypi.outputs.pypi_name }}
PYPI_NAME: ${{ steps.set-output.outputs.pypi_name }}
run: |
python .github/actions_scripts/parse.py
Expand Down

0 comments on commit 902260e

Please sign in to comment.