From 7c60372d5e4878dd0949bc01599df784511f5f40 Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 25 Sep 2023 11:36:56 -0400 Subject: [PATCH 1/3] Add jira workflow --- .github/workflows/jira.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/jira.yml diff --git a/.github/workflows/jira.yml b/.github/workflows/jira.yml new file mode 100644 index 0000000..2aa8d85 --- /dev/null +++ b/.github/workflows/jira.yml @@ -0,0 +1,34 @@ +name: Jira + +on: + pull_request: + branches: [main] + paths-ignore: ["*.md"] + +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" From a46ca1a7b8ecbc3f9dfafd250c9cbc1338e3b7ae Mon Sep 17 00:00:00 2001 From: Xavier Date: Tue, 26 Sep 2023 13:10:45 -0400 Subject: [PATCH 2/3] Exclude renovate PR from Jira validation --- .github/workflows/jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jira.yml b/.github/workflows/jira.yml index 2aa8d85..f2f9188 100644 --- a/.github/workflows/jira.yml +++ b/.github/workflows/jira.yml @@ -13,7 +13,7 @@ jobs: shell: pwsh run: | Install-Module JiraPS -Scope CurrentUser -Force - if ("$env:GITHUB_HEAD_REF" -like "*/renovate/*" -eq $True) + if ("$env:GITHUB_HEAD_REF" -like "*renovate/*" -eq $True) { Write-Host "Skipping, renovate branch detected" return From cbc94d1da4d38d66682a7a17a052aec0fcae6554 Mon Sep 17 00:00:00 2001 From: Xavier Date: Tue, 26 Sep 2023 13:28:06 -0400 Subject: [PATCH 3/3] Merge main --- .github/workflows/jira.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/jira.yml b/.github/workflows/jira.yml index 9d2faed..f2f9188 100644 --- a/.github/workflows/jira.yml +++ b/.github/workflows/jira.yml @@ -13,11 +13,7 @@ jobs: shell: pwsh run: | Install-Module JiraPS -Scope CurrentUser -Force -<<<<<<< HEAD if ("$env:GITHUB_HEAD_REF" -like "*renovate/*" -eq $True) -======= - if ("$env:GITHUB_HEAD_REF" -like "*/renovate/*" -eq $True) ->>>>>>> main { Write-Host "Skipping, renovate branch detected" return