Skip to content

Commit

Permalink
Several bug fixes (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulasozguler authored Jul 20, 2023
1 parent 6950c81 commit fed9d80
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
30 changes: 17 additions & 13 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,26 @@ runs:
- uses: actions/checkout@v3
- name: Get or create Github release
shell: bash
working-directory: ${{ github.action_path }}
env:
GH_TOKEN: ${{ github.token }}
run: |
(
gh api \
--method GET /repos/${{ github.repository }}/releases/tags/${{ github.ref_name }} \
--jq .body \
|| \
gh api \
--method POST /repos/${{ github.repository }}/releases \
-f tag_name='${{ github.ref_name }}' \
-f name='${{ github.ref_name }}' \
-F generate_release_notes=true \
--jq .body \
) > notes.md
gh api \
--method GET /repos/${{ github.repository }}/releases/tags/${{ github.ref_name }} \
--jq .body > notes.md \
|| \
gh api \
--method POST /repos/${{ github.repository }}/releases \
-f tag_name='${{ github.ref_name }}' \
-f name='${{ github.ref_name }}' \
-F generate_release_notes=true \
--jq .body > notes.md
- name: Update JIRA
shell: bash
working-directory: ${{ github.action_path }}
env:
INPUT_JIRA_SERVER: ${{ inputs.jira_server }}
INPUT_JIRA_PROJECT: ${{ inputs.jira_project }}
INPUT_JIRA_USER: ${{ inputs.jira_user }}
INPUT_JIRA_TOKEN: ${{ inputs.jira_token }}
run: python ./src/main.py
working-directory: ${{github.action_path}}
6 changes: 5 additions & 1 deletion src/notes_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

PROJECT = os.environ["INPUT_JIRA_PROJECT"]
ISSUE_PATTERN = rf"{PROJECT}-[0-9]+"
CHANGES_SECTION = "What's Changed"


def _get_section(md_content, section_title):
Expand All @@ -29,7 +30,10 @@ def extract_changes():
with open("notes.md", "r") as f:
content = f.read()

return _parse_changelist(_get_section(content, "What's Changed"))
if CHANGES_SECTION not in content:
return []

return _parse_changelist(_get_section(content, CHANGES_SECTION))


def extract_issue_id(change):
Expand Down

0 comments on commit fed9d80

Please sign in to comment.