-
Notifications
You must be signed in to change notification settings - Fork 18
/
action.yml
36 lines (34 loc) · 1.49 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: "Jira Release Web Hook"
description: "Creates a new Jira release and assigns all relevant issues to it."
inputs:
jira-project-key:
description: "Jira project identifier"
required: true
jira-automation-webhook:
description: "Jira automation webhook url"
required: true
build-version:
description: "Version identifier"
required: true
runs:
using: "composite"
steps:
- name: Fetch entire Git history (including tags)
run: |
[ "$(git rev-parse --is-shallow-repository)" = "true" ] && \
git fetch --prune --unshallow --tags || \
git fetch --prune --tags
shell: bash
- name: Collect issue numbers since last release/tag
run: |
export LC_ALL=en_US.utf8
git log $(git describe --abbrev=0 --tags 2> /dev/null || git rev-list --max-parents=0 HEAD)..HEAD | \
grep -oE "${{ inputs.jira-project-key }}-[[:digit:]]{1,}" | sort | uniq | \
sed 's/^\|$/"/g' | paste -sd , - | awk '{print "RELATED_JIRA_ISSUES="$0}' >> $GITHUB_ENV
shell: bash
- name: Create json and invoke webhook
run: |
$json = ConvertTo-Json @{issues = @(${{ env.RELATED_JIRA_ISSUES }}); data = @{version = "${{ inputs.build-version }}"; projectName = "${{ inputs.jira-project-key }}"}}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod ${{ inputs.jira-automation-webhook }} -Method Post -Body $json -ContentType "application/json"
shell: pwsh