Skip to content

Dependency Dashboard #8

Dependency Dashboard

Dependency Dashboard #8

# this workflow requires to provide JIRA webhook URL via JIRA_URL GitHub Secret
# read more: https://support.atlassian.com/cloud-automation/docs/jira-automation-triggers/#Automationtriggers-Incomingwebhook
# original code source: https://github.com/beliaev-maksim/github-to-jira-automation
name: Issues to JIRA
on:
issues:
# available via github.event.action
types: [opened, reopened, closed]
jobs:
update:
name: Update Issue
runs-on: ubuntu-latest
steps:
- name: Create JIRA ticket
env:
# put into env vars to properly escape special bash chars
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_DESCRIPTION: ${{ github.event.issue.body }}
run: |
# Determine Bug/Enhancement
if ${{ contains(github.event.*.labels.*.name, 'Bug') }}; then
type=bug
else
type=task
fi
# send JIRA request
# canonical doesn't encourage discussions in JIRA on pulic project issues.
# thus, it is NOT recommended to put description in JIRA in order to push conversation to GitHub
# if strongly required, then replace '--arg body ""' with the next line
# --arg body "$ISSUE_DESCRIPTION"
data=$( jq -n \
--arg title "$ISSUE_TITLE" \
--arg url '${{ github.event.issue.html_url }}' \
--arg submitter '${{ github.event.issue.user.login }}' \
--arg body "" \
--arg type "$type" \
--arg action '${{ github.event.action }}' \
'{title: $title, url: $url, submitter: $submitter, body: $body, type: $type, action: $action}' )
curl -X POST -H 'Content-type: application/json' --data "${data}" "${{ secrets.JIRA_URL }}"