From 15a41e579bac739881b316f905d7322ab188334f Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Sun, 15 Dec 2024 15:50:18 +0100 Subject: [PATCH] Pull excerpts from Armbian Jira --- .github/workflows/generate-jira-excerpt.yml | 40 ++++++++++++ scripts/pull-from-jira.py | 71 +++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 .github/workflows/generate-jira-excerpt.yml create mode 100755 scripts/pull-from-jira.py diff --git a/.github/workflows/generate-jira-excerpt.yml b/.github/workflows/generate-jira-excerpt.yml new file mode 100644 index 0000000..a3fb183 --- /dev/null +++ b/.github/workflows/generate-jira-excerpt.yml @@ -0,0 +1,40 @@ +name: "Pull from Armbian Jira" +on: + push: + workflow_dispatch: + +concurrency: + group: redirector + cancel-in-progress: false + +jobs: + jira: + runs-on: ubuntu-24.04 + name: "Get from Jira" + steps: + + - name: Checkout armbian.github.io repository + uses: actions/checkout@v4 + + - name: setup python + uses: actions/setup-python@v5 + with: + python-version: 3.8 #install the python needed + + - name: "Run script" + run: | + ./scripts/pull-from-jira.py + + - name: Commit changes if any + run: | + + cd armbian.github.io + git checkout data + mkdir -p data/ + mv ${{ github.workspace }}/jira-current.html data/ + mv ${{ github.workspace }}/jira-next.html data/ + git config --global user.name "github-actions" + git config --global user.email "github-actions@github.com" + git add data/. + git diff --cached --quiet || git commit -m "Update WEB indes files" + git push \ No newline at end of file diff --git a/scripts/pull-from-jira.py b/scripts/pull-from-jira.py new file mode 100755 index 0000000..a8a6845 --- /dev/null +++ b/scripts/pull-from-jira.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +# +# automatic displaying of what is assigned to fixversion +# for current and next release + +from jira import JIRA +jira = JIRA('https://armbian.atlassian.net') + +from datetime import datetime +month = datetime.now().strftime('%m') +year = datetime.now().year + +def icons(arg): + if str(arg) == "Bug": + return ("Bug") + if str(arg) == "Task": + return ("Task") + if str(arg) == "Story": + return ("Story") + if str(arg) == "Epic": + return ("Epic''") + +if ( month <= "12" ): + current_year=year+1 + current_month="02" + next_month="05" + next_year=year+1 + +if ( month <= "11" ): + current_year=year + current_month="11" + next_month="02" + next_year=year+1 + +if ( month <= "08" ): + current_year=year + current_month="08" + next_month="11" + next_year=year + +if ( month <= "05" ): + current_year=year + current_month="05" + next_month="08" + next_year=year + +if ( month <= "02" ): + current_year=year + current_month="02" + next_month="05" + next_year=year + +# current +f = open("jira-current.html", "w") +current=str(current_year)[2:]+"."+current_month +f.write('

Should be completed in '+current+'

Sorted by priority

') +f.write('
Check if you can review code that already waits at Pull reqests
') +f.write('
') +for issue in jira.search_issues('project=AR and fixVersion="'+current+'" and status!="Done" and status!="Closed" order by Priority', maxResults=100): + f.write('{} {}: {}, Assigned to: {}'.format(issue.key, icons(issue.fields.issuetype), issue.fields.issuetype, issue.fields.summary, issue.fields.assignee )) +f.write('
'); +f.close() + +# next +f = open("jira-next.html", "w") +next=str(next_year)[2:]+"."+next_month +f.write('

Planned for '+next+' and further

Sorted by priority

') +for issue in jira.search_issues('project=AR and fixVersion="'+next+'" and status!="Done" and status!="Closed" order by priority desc', maxResults=100): + f.write('{} {}: {}, Assigned to: {}'.format(issue.key, icons(issue.fields.issuetype), issue.fields.issuetype, issue.fields.summary, issue.fields.assignee)) +f.write('
'); +f.close()