Skip to content

Commit

Permalink
Added workflow to create issue in jira
Browse files Browse the repository at this point in the history
Added workflow and trigger to ceate jira issues for all open pr's by
dependabot

ND-271
  • Loading branch information
sb21460 committed Jan 3, 2025
1 parent f0ddd1e commit 851d83e
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/dependabot-pr-to-jira-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Add Issue to Jira Board On new Dependabot PR's

on:
pull_request_target:
types:
- opened
- review_requested

jobs:
call-workflow-dependabot-pr-to-jira:
if: github.event.issues.user.login == 'dependabot[bot]'
# uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@main
secrets:
TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }}
TECH_SERVICES_JIRA_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }}
TECH_SERVICES_JIRA_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }}
56 changes: 56 additions & 0 deletions .github/workflows/dependabot-pr-to-jira.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
on:
workflow_call:
secrets:
TECH_SERVICES_JIRA_URL:
description: 'jira URL passed from the caller workflow'
required: true
TECH_SERVICES_JIRA_EMAIL:
description: 'email address passed from the caller workflow'
required: true
TECH_SERVICES_JIRA_TOKEN:
description: 'A token passed from the caller workflow'
required: true

jobs:
build:
runs-on: ubuntu-latest
name: Create Jira Ticket
steps:
- name: Login
uses: atlassian/gajira-login@master
env:
JIRA_BASE_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }}
JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }}

- name: Create
id: create
uses: atlassian/gajira-create@master
with:
project: ND
issuetype: Story
summary: |
${{ github.event.issue.title }} [GH#${{ github.event.issue.number }}]
description: |
{panel}
*Created By:* ${{ github.event.issue.user.login }}
[Github permalink|${{ github.event.issue.html_url }}]
{panel}
- name: Log created issue
run: echo "Issue ${{ steps.create.outputs.issue }} was created"

- name: comment on github
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '${{ steps.create.outputs.issue }} created on Jira board and transitioned to backlog' })
- name: Transition issue
uses: atlassian/gajira-transition@master
with:
issue: ${{ steps.create.outputs.issue }}
transition: "Backlog"

0 comments on commit 851d83e

Please sign in to comment.