add Jira issue enforce workflow template

This commit is contained in:
Max Brenner
2021-02-01 19:06:41 +01:00
parent b11d3f5277
commit c4b7e59a33
3 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
{
"name": "Enforce Jira issue workflow",
"description": "A workflow that enforce to have a Jira issue key in the branch name or PR name when creating a PR.",
"iconName": "workflow-icon"
}

View File

@@ -0,0 +1,37 @@
name: Ensure Jira issue is linked
on:
pull_request:
types: [opened, edited, reopened, synchronize]
jobs:
check_for_issue_key:
runs-on: ubuntu-latest
steps:
- name: Log into Jira
uses: atlassian/gajira-login@v2.0.0
env:
JIRA_BASE_URL: ${{ secrets.TIP_JIRA_URL }}
JIRA_USER_EMAIL: ${{ secrets.TIP_JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.TIP_JIRA_API_TOKEN }}
- name: Find issue key in PR title
id: issue_key_pr_title
continue-on-error: true
uses: atlassian/gajira-find-issue-key@v2.0.2
with:
string: ${{ github.event.pull_request.title }}
from: "" # required workaround for bug https://github.com/atlassian/gajira-find-issue-key/issues/24
- name: Find issue key in branch name
continue-on-error: true
id: issue_key_branch_name
uses: atlassian/gajira-find-issue-key@v2.0.2
with:
string: ${{ github.event.pull_request.head.ref }}
from: "" # required workaround for bug https://github.com/atlassian/gajira-find-issue-key/issues/24
- name: Check if issue key was found
run: |
if [[ -z "${{ steps.issue_key_pr_title.outputs.issue }}" && -z "${{ steps.issue_key_branch_name.outputs.issue }}" ]]; then
echo "Jira issue key could not be found!"
exit 1
fi

View File

@@ -0,0 +1 @@
<svg width="300" height="300" viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg"><rect id="bg" width="300" height="300" fill="rgb(129,166,164)" /><path d="m 150 599 Q 268 32 -299 150 Q 268 268 150 -299 Q 32 268 599 150 Q 32 32 150 599 z" fill="rgb(190,233,111)" /><path d="m 150 375 Q 134 166 -75 150 Q 134 134 150 -75 Q 166 134 375 150 Q 166 166 150 375 z" fill="rgb(65,22,144)" /><path d="m 150 131 Q 195 105 169 150 Q 195 195 150 169 Q 105 195 131 150 Q 105 105 150 131 z" fill="rgb(126,89,91)" /></svg>

After

Width:  |  Height:  |  Size: 512 B