mirror of
https://github.com/Telecominfraproject/.github.git
synced 2026-01-27 10:21:10 +00:00
add Jira issue enforce workflow template
This commit is contained in:
@@ -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"
|
||||
}
|
||||
37
workflow-templates/enforce-jira-issue-key.yml
Normal file
37
workflow-templates/enforce-jira-issue-key.yml
Normal 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
|
||||
1
workflow-templates/workflow-icon.svg
Normal file
1
workflow-templates/workflow-icon.svg
Normal 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 |
Reference in New Issue
Block a user