generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added workflow to create issue in jira
Added workflow and trigger to ceate jira issues for all open pr's by dependabot ND-271
- Loading branch information
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |