diff --git a/.circleci/config.yml b/.circleci/config.yml index 74ae3d3..4491d98 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,6 +51,21 @@ jobs: gem build pronto-commentator gem push pronto-commentator-*.gem + update_jira: + docker: + - image: alpine:3.8 + auth: + username: $DOCKERHUB_USERNAME + password: $DOCKERHUB_TOKEN + steps: + - run: + name: Install dependencies + command: apk add --no-cache bash curl git openssh + - checkout + - run: + name: Update JIRA + command: .circleci/update-jira.sh + workflows: version: 2 test_and_deploy: @@ -74,3 +89,10 @@ workflows: - /^v.*/ context: - DockerHub + - RubyGems + - update_jira: + context: + - DockerHub + - update-jira-webhook + requires: + - push_to_rubygems diff --git a/.circleci/update-jira.sh b/.circleci/update-jira.sh new file mode 100755 index 0000000..4eadf3f --- /dev/null +++ b/.circleci/update-jira.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Use JIRA automation webhooks to move issues to SHIPPED: +# https://support.atlassian.com/jira-software-cloud/docs/automation-triggers/#Automationtriggers-Incomingwebhook + +git log --max-count=50 --pretty=format:'%s' | grep -Eo '^\w+-[0-9]+' | sort -u | while read i; do + curl -X POST "$UPDATE_JIRA_WEBHOOK_URL?issue=$i" +done