Skip to content

Commit

Permalink
chore: Add priorities to Jira issues when created (#146)
Browse files Browse the repository at this point in the history
Copy the config over from `hugr`.
Resolves #137
  • Loading branch information
croyzor authored Oct 3, 2023
1 parent 0dcf5e0 commit 8e6692c
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions .github/workflows/issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,55 @@ jobs:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
- name: Parse the priority label into a Jira priority
id: set_priority_var
env:
LABELS: ${{ join(github.event.issue.labels.*.name, ' ') }}
run: |
MY_RESULT=""
for label in $LABELS
do
case $label in
P-low)
MY_RESULT=Low
break;;
P-medium)
MY_RESULT=Medium
break;;
P-high)
MY_RESULT=High
break;;
P-critical)
MY_RESULT=Highest
break;;
esac
done
if [ ! -z $MY_RESULT ]
then
MY_RESULT=", \"priority\": { \"name\": \"$MY_RESULT\" }"
fi
echo "JIRA_PRIORITY_FIELD=$MY_RESULT" >> $GITHUB_OUTPUT
- name: Create Bug
uses: atlassian/[email protected]
if: "contains(github.event.issue.labels.*.name, 'bug')"
if: ${{ contains(github.event.issue.labels.*.name, 'bug') }}
env:
JIRA_PRIORITY_FIELD: ${{ steps.set_priority_var.outputs.JIRA_PRIORITY_FIELD }}
with:
project: TKET
issuetype: Bug
summary: « [tket2] ${{ github.event.issue.title }}»
description: ${{ github.event.issue.html_url }}
fields: '{"labels": ["tket2"]}'
fields: '{ "labels": ["tket2"] ${{ env.JIRA_PRIORITY_FIELD }} }'

- name: Create Task
uses: atlassian/[email protected]
if: "! contains(github.event.issue.labels.*.name, 'bug')"
if: ${{ ! contains(github.event.issue.labels.*.name, 'bug') }}
env:
JIRA_PRIORITY_FIELD: ${{ steps.set_priority_var.outputs.JIRA_PRIORITY_FIELD }}
with:
project: TKET
issuetype: Task
summary: « [tket2] ${{ github.event.issue.title }}»
description: ${{ github.event.issue.html_url }}
fields: '{"labels": ["tket2"]}'
fields: '{ "labels": ["tket2"] ${{ env.JIRA_PRIORITY_FIELD }} }'

0 comments on commit 8e6692c

Please sign in to comment.