Skip to content

Commit

Permalink
[IDP-912] Add callable Jira validation github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
heqianwang committed Mar 4, 2024
1 parent c3f9af6 commit 143ba00
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/jira-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Jira

on:
workflow_call:

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Check Jira Story
shell: pwsh
run: |
Install-Module JiraPS -Scope CurrentUser -Force
if ("$env:GITHUB_HEAD_REF" -like "*renovate/*" -eq $True)
{
Write-Host "Skipping, renovate branch detected"
return
}
Set-JiraConfigServer -Server "${{ secrets.JIRA_URL }}"
if("$env:GITHUB_HEAD_REF" -match "IDP-[0-9]+" -eq $False)
{
throw "Branch name $env:GITHUB_HEAD_REF doesn't respect the required pattern."
}
$JiraIssueKey = $Matches[0]
$PWord = ConvertTo-SecureString -String "${{ secrets.JIRA_API_TOKEN }}" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "${{ secrets.JIRA_USERNAME }}", $PWord
Write-Host "Retrieving Jira issue with number $JiraIssueKey"
Get-JiraIssue -Key $JiraIssueKey -Credential $Credential -ErrorAction Stop | out-null
Write-Host "Successfully retrieved Jira issue"

0 comments on commit 143ba00

Please sign in to comment.