From f2f8c5028f37ddd63ad1df5601c7264eea985ad8 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 17:59:59 +0000 Subject: [PATCH 001/172] ND-271 Ammended the trigger for PR automation Amended the trigger to included PR status's open,reopened and synchronize ND-271 --- .../dependabot-pr-to-jira-trigger.yml | 17 ++++++ .github/workflows/dependabot-pr-to-jira.yml | 56 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/workflows/dependabot-pr-to-jira-trigger.yml create mode 100644 .github/workflows/dependabot-pr-to-jira.yml diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml new file mode 100644 index 0000000..df460ad --- /dev/null +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -0,0 +1,17 @@ +name: Add Issue to Jira Board On new Dependabot PR's + +on: + pull_request: + types: + - opened + - reopened + - synchronize + +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 + 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 }} diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml new file mode 100644 index 0000000..6c47fc4 --- /dev/null +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -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: + check-open-prs: + 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" From 91869aabc9925314c1366a3ced7f5b87bbf012a9 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 18:02:38 +0000 Subject: [PATCH 002/172] ND-271 Added the version of yml to solve the error --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index df460ad..d690479 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -10,7 +10,7 @@ on: 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 + 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 }} From d9476b5decf53b32a0baff6d1cb28f516051d321 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 18:15:19 +0000 Subject: [PATCH 003/172] ND-271 corrected the version of yml to resolve the error --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index d690479..27110e8 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -10,7 +10,7 @@ on: 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 + uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@master secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} TECH_SERVICES_JIRA_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} From 39ddd442878233cc65cc6bdefc90fce70c05474b Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 18:17:20 +0000 Subject: [PATCH 004/172] ND-271 amended the version of yml to resolve the error --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 27110e8..bbbe611 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -10,8 +10,9 @@ on: 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@master + uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira 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 }} + From 63ea25b2b41c9b9c18c32f84627559eea22a6daa Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 18:44:56 +0000 Subject: [PATCH 005/172] Updated the project code ND-271 --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 6c47fc4..c5be77b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,7 +27,7 @@ jobs: id: create uses: atlassian/gajira-create@master with: - project: ND + project: CNSA issuetype: Story summary: | ${{ github.event.issue.title }} [GH#${{ github.event.issue.number }}] From 87be1aab061b598f359eeb5b9bf22029d821e3eb Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 19:02:29 +0000 Subject: [PATCH 006/172] Updated the project code to DISO DevOps ND-271 --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index c5be77b..026180c 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,7 +27,7 @@ jobs: id: create uses: atlassian/gajira-create@master with: - project: CNSA + project: DISO DevOps issuetype: Story summary: | ${{ github.event.issue.title }} [GH#${{ github.event.issue.number }}] From ba5c04252d331ac72bdcbd67220addb76158aab5 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 19:04:17 +0000 Subject: [PATCH 007/172] Updated the project code to ND ND-271 --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 026180c..6c47fc4 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,7 +27,7 @@ jobs: id: create uses: atlassian/gajira-create@master with: - project: DISO DevOps + project: ND issuetype: Story summary: | ${{ github.event.issue.title }} [GH#${{ github.event.issue.number }}] From 33a8574de511ff42e5d06d6874d6cfc1c0c7870a Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 19:07:07 +0000 Subject: [PATCH 008/172] Included the criteria to check for dependabot tickets ND-271 --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index bbbe611..aecf9e3 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -9,7 +9,7 @@ on: jobs: call-workflow-dependabot-pr-to-jira: - #if: github.event.issues.user.login == 'dependabot[bot]' + if: github.event.issues.user.login == 'dependabot[bot]' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From 531c14a72b96fa0ea20b666645bde9e5e8cbb006 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 19:10:49 +0000 Subject: [PATCH 009/172] Updated the criteria to check for dependabot tickets ND-271 --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index aecf9e3..fdb460e 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -9,7 +9,7 @@ on: jobs: call-workflow-dependabot-pr-to-jira: - if: github.event.issues.user.login == 'dependabot[bot]' + if: github.actor == 'dependabot[bot]' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From eb99f9c83f842049273f24015c5d10bd6202b012 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 19:13:39 +0000 Subject: [PATCH 010/172] Updated the criteria (github.event.pull_request.user.login) to check for dependabot tickets ND-271 --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index fdb460e..ad1bbbc 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -9,7 +9,7 @@ on: jobs: call-workflow-dependabot-pr-to-jira: - if: github.actor == 'dependabot[bot]' + if: github.event.pull_request.user.login == 'dependabot[bot]' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From 3f4d3c7a01ef5f91128942ae1a4b5667ffa82cdf Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 19:22:37 +0000 Subject: [PATCH 011/172] Updated the criteria (github.event.pull_request.user.login) to check for dependabot tickets ND-271 --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index ad1bbbc..b5e3129 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -9,7 +9,7 @@ on: jobs: call-workflow-dependabot-pr-to-jira: - if: github.event.pull_request.user.login == 'dependabot[bot]' + if: github.event.pull_request.user.login == 'Dependabot' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From 9d052c97c482b4e24a0b62adc3612508b5c1253b Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 19:23:38 +0000 Subject: [PATCH 012/172] Updated the criteria (github.event.pull_request.user.login) to check for dependabot tickets ND-271 --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index b5e3129..9cf9ca7 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -9,7 +9,7 @@ on: jobs: call-workflow-dependabot-pr-to-jira: - if: github.event.pull_request.user.login == 'Dependabot' + if: github.event.pull_request.user.login == 'Dependabot[bot]' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From e2cf6d26da003ba76b9e009dd766033949d41f9f Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 19:26:39 +0000 Subject: [PATCH 013/172] Updated the criteria (github.event.pull_request.user.login) to check for dependabot tickets ND-271 --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 9cf9ca7..70bb879 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -9,7 +9,7 @@ on: jobs: call-workflow-dependabot-pr-to-jira: - if: github.event.pull_request.user.login == 'Dependabot[bot]' + if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'sb21460' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From 13f343ee65f7c1d64aeab4b6840971ece27af9e9 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 19:58:32 +0000 Subject: [PATCH 014/172] ND-271 added jira project as environmental variable --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 1 + .github/workflows/dependabot-pr-to-jira.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 70bb879..02e8cd2 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -15,4 +15,5 @@ jobs: 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 }} + TECH_SERVICES_JIRA_PROJECT: ${{ secrets.TECH_SERVICES_JIRA_PROJECT }} diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 6c47fc4..056669b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -10,6 +10,9 @@ on: TECH_SERVICES_JIRA_TOKEN: description: 'A token passed from the caller workflow' required: true + TECH_SERVICES_JIRA_PROJECT: + description: 'JIRA Project code passed from the caller workflow' + required: true jobs: check-open-prs: @@ -22,6 +25,7 @@ jobs: JIRA_BASE_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + JIRA_PROJECT: ${{ secrets.TECH_SERVICES_JIRA_PROJECT }} - name: Create id: create From bc2eaaa907f2bdc49cec48fac31f221dc9c683e7 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 20:00:34 +0000 Subject: [PATCH 015/172] ND-271 removed Jira project parameter --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 1 - .github/workflows/dependabot-pr-to-jira.yml | 2 -- 2 files changed, 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 02e8cd2..70bb879 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -15,5 +15,4 @@ jobs: 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 }} - TECH_SERVICES_JIRA_PROJECT: ${{ secrets.TECH_SERVICES_JIRA_PROJECT }} diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 056669b..7737374 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -25,13 +25,11 @@ jobs: JIRA_BASE_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} - JIRA_PROJECT: ${{ secrets.TECH_SERVICES_JIRA_PROJECT }} - name: Create id: create uses: atlassian/gajira-create@master with: - project: ND issuetype: Story summary: | ${{ github.event.issue.title }} [GH#${{ github.event.issue.number }}] From e65f3985746a5c59cc3c9ba7e3459a47898e7948 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 20:01:46 +0000 Subject: [PATCH 016/172] ND-271 removed Jira project parameter --- .github/workflows/dependabot-pr-to-jira.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 7737374..fa6be15 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -10,9 +10,6 @@ on: TECH_SERVICES_JIRA_TOKEN: description: 'A token passed from the caller workflow' required: true - TECH_SERVICES_JIRA_PROJECT: - description: 'JIRA Project code passed from the caller workflow' - required: true jobs: check-open-prs: From 8803af1f2c4db1dd6bde7af42ba8cecd66be8283 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 9 Jan 2025 20:12:52 +0000 Subject: [PATCH 017/172] ND-271 updated Jira project parameter --- .github/workflows/dependabot-pr-to-jira.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index fa6be15..99378bb 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,7 +27,8 @@ jobs: id: create uses: atlassian/gajira-create@master with: - issuetype: Story + project: 'ND' + issuetype: 'Story' summary: | ${{ github.event.issue.title }} [GH#${{ github.event.issue.number }}] description: | From 67171b264218723be86de96561e31296603f35ce Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 15 Jan 2025 15:53:47 +0000 Subject: [PATCH 018/172] updated the project id to 15280 --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 99378bb..5b5af7d 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,7 +27,7 @@ jobs: id: create uses: atlassian/gajira-create@master with: - project: 'ND' + project: '15280' issuetype: 'Story' summary: | ${{ github.event.issue.title }} [GH#${{ github.event.issue.number }}] From a442a674d32532a1d4a41f38c2348f88627d7e88 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 16 Jan 2025 23:18:13 +0000 Subject: [PATCH 019/172] updated the project key to ND' --- .github/workflows/dependabot-pr-to-jira.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5b5af7d..5857001 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,7 +27,8 @@ jobs: id: create uses: atlassian/gajira-create@master with: - project: '15280' + project: 'ND' + project-id issuetype: 'Story' summary: | ${{ github.event.issue.title }} [GH#${{ github.event.issue.number }}] From 789af28316099a70740ef6f02435edeabe522224 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 16 Jan 2025 23:19:53 +0000 Subject: [PATCH 020/172] Corrected the workflow to rectify the errors --- .github/workflows/dependabot-pr-to-jira.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5857001..99378bb 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -28,7 +28,6 @@ jobs: uses: atlassian/gajira-create@master with: project: 'ND' - project-id issuetype: 'Story' summary: | ${{ github.event.issue.title }} [GH#${{ github.event.issue.number }}] From f99e7ee30da77d732312fabf90fc5a09f44c2866 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 20 Jan 2025 18:25:26 +0000 Subject: [PATCH 021/172] Modified the description to add PR details to Jira ticket created --- .github/workflows/dependabot-pr-to-jira.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 99378bb..111b8d9 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -30,12 +30,13 @@ jobs: project: 'ND' issuetype: 'Story' summary: | - ${{ github.event.issue.title }} [GH#${{ github.event.issue.number }}] + ${{ github.event.pull_request.title }} [GH#${{ github.event.pull_request.number }}] description: | {panel} - *Created By:* ${{ github.event.issue.user.login }} - [Github permalink|${{ github.event.issue.html_url }}] + *Created By:* ${{ github.event.pull_request.user.login }} + [Github permalink|${{ github.event.pull_request.html_url }}] {panel} + - name: Log created issue run: echo "Issue ${{ steps.create.outputs.issue }} was created" From 411e32d6538b830fa35f1cd34b5284c07327d1c3 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 20 Jan 2025 18:29:50 +0000 Subject: [PATCH 022/172] Updated the user to test for dependabot --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 70bb879..ad1bbbc 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -9,7 +9,7 @@ on: jobs: call-workflow-dependabot-pr-to-jira: - if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'sb21460' + if: github.event.pull_request.user.login == 'dependabot[bot]' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From 22124ef71e8d5bac002c7cfba24f0d578fd3e1d4 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 20 Jan 2025 19:11:25 +0000 Subject: [PATCH 023/172] ND-271 updated the create jira section to include dependabot details --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 10 ++++------ .github/workflows/dependabot-pr-to-jira.yml | 10 ++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index ad1bbbc..47a14ea 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -1,11 +1,9 @@ name: Add Issue to Jira Board On new Dependabot PR's -on: - pull_request: - types: - - opened - - reopened - - synchronize +on: pull_request +permissions: + contents: read + pull-requests: read jobs: call-workflow-dependabot-pr-to-jira: diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 111b8d9..d7de3fa 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -23,6 +23,13 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Create id: create uses: atlassian/gajira-create@master @@ -35,6 +42,9 @@ jobs: {panel} *Created By:* ${{ github.event.pull_request.user.login }} [Github permalink|${{ github.event.pull_request.html_url }}] + Dependency names: ${{ steps.metadata.outputs.dependency-names }} + Dependency type: ${{ steps.metadata.outputs.dependency-type }} + Update type: ${{ steps.metadata.outputs.update-type }} {panel} - name: Log created issue From 5d8d373d968f2a15b42e4441231a25fa88dec2c6 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 20 Jan 2025 19:14:31 +0000 Subject: [PATCH 024/172] ND-271 removed the user check to test --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 47a14ea..5a86f28 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -7,7 +7,6 @@ permissions: jobs: call-workflow-dependabot-pr-to-jira: - if: github.event.pull_request.user.login == 'dependabot[bot]' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From 4f3da1b8328330b45020f535307140fe86a77c83 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Tue, 21 Jan 2025 05:55:04 +0000 Subject: [PATCH 025/172] created a workflow to list all PR's for test purpose --- .github/workflows/display_pr.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/display_pr.yml diff --git a/.github/workflows/display_pr.yml b/.github/workflows/display_pr.yml new file mode 100644 index 0000000..87c0607 --- /dev/null +++ b/.github/workflows/display_pr.yml @@ -0,0 +1,16 @@ +name: List All Pull Requests +on: + workflow_dispatch: # Trigger manually +permissions: + pull-requests: read +jobs: + list-prs: + runs-on: ubuntu-latest + steps: + - name: List all pull requests + run: | + curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github+json" \ + "https://api.github.com/repos/${{ github.repository }}/pulls" > prs.json + echo "Fetched pull requests:" + cat prs.json \ No newline at end of file From cf7ccd72e420b67d5a26ca601f9c44100413788e Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Tue, 21 Jan 2025 06:05:00 +0000 Subject: [PATCH 026/172] updated the workflow to edit the trigger --- .../dependabot-pr-to-jira-trigger.yml | 9 +++++- .github/workflows/dependabot-pr-to-jira.yml | 29 +++++++------------ .github/workflows/display_pr.yml | 16 ---------- 3 files changed, 19 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/display_pr.yml diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 5a86f28..c6101a2 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -1,6 +1,13 @@ name: Add Issue to Jira Board On new Dependabot PR's -on: pull_request +on: + push: + branches: + - ND-271-spike-dependabot-ticket-auto-creation-in-jira + pull_request: + branches: + - main + permissions: contents: read pull-requests: read diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index d7de3fa..004422c 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -23,29 +23,14 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} - - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Create id: create uses: atlassian/gajira-create@master with: project: 'ND' issuetype: 'Story' - summary: | - ${{ github.event.pull_request.title }} [GH#${{ github.event.pull_request.number }}] - description: | - {panel} - *Created By:* ${{ github.event.pull_request.user.login }} - [Github permalink|${{ github.event.pull_request.html_url }}] - Dependency names: ${{ steps.metadata.outputs.dependency-names }} - Dependency type: ${{ steps.metadata.outputs.dependency-type }} - Update type: ${{ steps.metadata.outputs.update-type }} - {panel} + summary: 'New Issue from GitHub: ${{ github.event.issue.title }}' + description: 'This task was automatically created from an issue in GitHub: ${{ github.event.issue.html_url }}' - name: Log created issue run: echo "Issue ${{ steps.create.outputs.issue }} was created" @@ -64,4 +49,12 @@ jobs: uses: atlassian/gajira-transition@master with: issue: ${{ steps.create.outputs.issue }} - transition: "Backlog" + transition: "DevRefinement" + + - name: List all pull requests + run: | + curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github+json" \ + "https://api.github.com/repos/${{ github.repository }}/pulls" > prs.json + echo "Fetched pull requests:" + cat prs.json diff --git a/.github/workflows/display_pr.yml b/.github/workflows/display_pr.yml deleted file mode 100644 index 87c0607..0000000 --- a/.github/workflows/display_pr.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: List All Pull Requests -on: - workflow_dispatch: # Trigger manually -permissions: - pull-requests: read -jobs: - list-prs: - runs-on: ubuntu-latest - steps: - - name: List all pull requests - run: | - curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github+json" \ - "https://api.github.com/repos/${{ github.repository }}/pulls" > prs.json - echo "Fetched pull requests:" - cat prs.json \ No newline at end of file From a6dca90d9c9a1f74dd7c85ea2620b2a1e7ca9f80 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Tue, 21 Jan 2025 06:11:33 +0000 Subject: [PATCH 027/172] updated the permissions to allow writting comments in github --- .../dependabot-pr-to-jira-trigger.yml | 4 --- .github/workflows/dependabot-pr-to-jira.yml | 29 ++++++++++++------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index c6101a2..3678c2b 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -8,10 +8,6 @@ on: branches: - main -permissions: - contents: read - pull-requests: read - jobs: call-workflow-dependabot-pr-to-jira: uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 004422c..ec861cc 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -23,14 +23,29 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@master + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Create id: create uses: atlassian/gajira-create@master with: project: 'ND' issuetype: 'Story' - summary: 'New Issue from GitHub: ${{ github.event.issue.title }}' - description: 'This task was automatically created from an issue in GitHub: ${{ github.event.issue.html_url }}' + summary: | + ${{ github.event.pull_request.title }} [GH#${{ github.event.pull_request.number }}] + description: | + {panel} + *Created By:* ${{ github.event.pull_request.user.login }} + [Github permalink|${{ github.event.pull_request.html_url }}] + Dependency names: ${{ steps.metadata.outputs.dependency-names }} + Dependency type: ${{ steps.metadata.outputs.dependency-type }} + Update type: ${{ steps.metadata.outputs.update-type }} + {panel} - name: Log created issue run: echo "Issue ${{ steps.create.outputs.issue }} was created" @@ -49,12 +64,4 @@ jobs: uses: atlassian/gajira-transition@master with: issue: ${{ steps.create.outputs.issue }} - transition: "DevRefinement" - - - name: List all pull requests - run: | - curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github+json" \ - "https://api.github.com/repos/${{ github.repository }}/pulls" > prs.json - echo "Fetched pull requests:" - cat prs.json + transition: "Backlog" From 72996e47e9cbbaf118a10f06acc9a013e22902ac Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Tue, 21 Jan 2025 06:13:09 +0000 Subject: [PATCH 028/172] removed the code to fetch dependabot meta data --- .github/workflows/dependabot-pr-to-jira.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index ec861cc..86382cb 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -23,13 +23,6 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} - - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@master - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Create id: create uses: atlassian/gajira-create@master From 3cdc8e26e20ead81e5734ae4a005b93c6e49af30 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 11:58:23 +0000 Subject: [PATCH 029/172] reverted to test earlioer commit --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 2 +- .github/workflows/dependabot-pr-to-jira.yml | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 47a14ea..3c8fda5 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -7,7 +7,7 @@ permissions: jobs: call-workflow-dependabot-pr-to-jira: - if: github.event.pull_request.user.login == 'dependabot[bot]' + if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'sb21460' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index d7de3fa..111b8d9 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -23,13 +23,6 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} - - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Create id: create uses: atlassian/gajira-create@master @@ -42,9 +35,6 @@ jobs: {panel} *Created By:* ${{ github.event.pull_request.user.login }} [Github permalink|${{ github.event.pull_request.html_url }}] - Dependency names: ${{ steps.metadata.outputs.dependency-names }} - Dependency type: ${{ steps.metadata.outputs.dependency-type }} - Update type: ${{ steps.metadata.outputs.update-type }} {panel} - name: Log created issue From 89ccef33d610275110c0d7b726dc62c38cee7e6c Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 12:07:13 +0000 Subject: [PATCH 030/172] Updated the trigger for the workflow --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 7 +++---- .github/workflows/dependabot-pr-to-jira.yml | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 3c8fda5..5a419b0 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -1,9 +1,8 @@ name: Add Issue to Jira Board On new Dependabot PR's -on: pull_request -permissions: - contents: read - pull-requests: read +on: + pull_request_review: + types: [requested] jobs: call-workflow-dependabot-pr-to-jira: diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 111b8d9..1c07c88 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -55,3 +55,4 @@ jobs: with: issue: ${{ steps.create.outputs.issue }} transition: "Backlog" + From 4858f689b2d317556a027672c20943c5f79b87d2 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 12:21:01 +0000 Subject: [PATCH 031/172] Updated the trigger for the workflow --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 5a419b0..a0cbacc 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -1,12 +1,14 @@ name: Add Issue to Jira Board On new Dependabot PR's on: - pull_request_review: - types: [requested] + pull_request: + branches: + - main + types: [ opened, review_requested ] jobs: call-workflow-dependabot-pr-to-jira: - if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'sb21460' + if: github.event.pull_request.user.login == 'dependabot[bot]' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From 3d08d913b1343d6f436dc85b251554776c048c76 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 12:39:35 +0000 Subject: [PATCH 032/172] Updated the trigger for the workflow --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index a0cbacc..51cad98 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -1,14 +1,13 @@ name: Add Issue to Jira Board On new Dependabot PR's on: - pull_request: + push: branches: - - main - types: [ opened, review_requested ] + - ND-271-spike-dependabot-ticket-auto-creation-in-jira jobs: call-workflow-dependabot-pr-to-jira: - if: github.event.pull_request.user.login == 'dependabot[bot]' + if: github.ref == 'refs/heads/ND-271-spike-dependabot-ticket-auto-creation-in-jira' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From 32d65785a35d3081ddbe2f605055d73e62ca5424 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 13:26:53 +0000 Subject: [PATCH 033/172] Updated the include multiple PR's in the ticket description --- .github/workflows/dependabot-pr-to-jira.yml | 26 ++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 1c07c88..976e0b1 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -29,26 +29,30 @@ jobs: with: project: 'ND' issuetype: 'Story' - summary: | - ${{ github.event.pull_request.title }} [GH#${{ github.event.pull_request.number }}] + summary: 'Dependabot PRs for ${{ github.repository_url }}' description: | {panel} - *Created By:* ${{ github.event.pull_request.user.login }} - [Github permalink|${{ github.event.pull_request.html_url }}] + *Dependabot PRs:* + $(cat dependabot-prs.json | jq -r '.[] | "- PR #\(.number): \(.title) (branch: \(.head))"') {panel} - name: Log created issue run: echo "Issue ${{ steps.create.outputs.issue }} was created" - - name: comment on github + - 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' }) + script: | + prs=$(cat dependabot-prs.json) + for pr in $(echo "${prs}" | jq -c '.[]'); do + number=$(echo "${pr}" | jq -r '.number') + github.rest.issues.createComment({ + issue_number: number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '${{ steps.create.outputs.issue }} created on Jira board and transitioned to backlog' + }) + done - name: Transition issue uses: atlassian/gajira-transition@master From 7d2ec7377c4e82d941b0fc5c072734aa51658311 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 13:33:16 +0000 Subject: [PATCH 034/172] Updated the include multiple PR's in the ticket description --- .github/workflows/dependabot-pr-to-jira.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 976e0b1..45c587d 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -23,6 +23,10 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + - name: List open Dependabot PRs on main branch + run: | + gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --author dependabot[bot] --json number,title,headRefName --jq '.[] | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json + - name: Create id: create uses: atlassian/gajira-create@master From a0ac0be4cb9e562a1899c637b6675e754d675bb1 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 13:35:24 +0000 Subject: [PATCH 035/172] Added github token to allow access for Github CLI --- .github/workflows/dependabot-pr-to-jira.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 45c587d..5e7abe3 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -24,6 +24,8 @@ jobs: JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} - name: List open Dependabot PRs on main branch + env: + GH_TOKEN: ${{ github.token }} run: | gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --author dependabot[bot] --json number,title,headRefName --jq '.[] | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json From 09e5fe9a1cdcbd8fa6f34076a90362fbb8bbba6a Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 13:52:41 +0000 Subject: [PATCH 036/172] Edited the description of jira ticket to diaplay all PR's --- .github/workflows/dependabot-pr-to-jira.yml | 30 ++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5e7abe3..2a8b6ad 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -29,6 +29,12 @@ jobs: run: | gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --author dependabot[bot] --json number,title,headRefName --jq '.[] | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json + - name: Format PRs for Jira description + id: format-prs + run: | + PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | "- PR #\(.number): \(.title) (branch: \(.head))"' | tr '\n' ' ') + echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV + - name: Create id: create uses: atlassian/gajira-create@master @@ -39,7 +45,7 @@ jobs: description: | {panel} *Dependabot PRs:* - $(cat dependabot-prs.json | jq -r '.[] | "- PR #\(.number): \(.title) (branch: \(.head))"') + ${{ env.PR_DESCRIPTION }} {panel} - name: Log created issue @@ -48,17 +54,17 @@ jobs: - name: Comment on GitHub uses: actions/github-script@v7 with: - script: | - prs=$(cat dependabot-prs.json) - for pr in $(echo "${prs}" | jq -c '.[]'); do - number=$(echo "${pr}" | jq -r '.number') - github.rest.issues.createComment({ - issue_number: number, - owner: context.repo.owner, - repo: context.repo.repo, - body: '${{ steps.create.outputs.issue }} created on Jira board and transitioned to backlog' - }) - done + script: | + const prs = $(cat dependabot-prs.json); + prs.forEach(pr => { + const number = pr.number; + github.rest.issues.createComment({ + issue_number: 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 From 391cc4519c4b46aa0eaf72fc32ca26f27da20169 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 13:58:51 +0000 Subject: [PATCH 037/172] Edited the description of jira ticket to diaplay all PR's --- .github/workflows/dependabot-pr-to-jira.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 2a8b6ad..b8541cf 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -29,11 +29,11 @@ jobs: run: | gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --author dependabot[bot] --json number,title,headRefName --jq '.[] | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json - - name: Format PRs for Jira description - id: format-prs - run: | - PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | "- PR #\(.number): \(.title) (branch: \(.head))"' | tr '\n' ' ') - echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV + - name: Format PRs for Jira description + id: format-prs + run: | + PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | select(type == "object") | "- PR #\(.number): \(.title) (branch: \(.head))"' | tr '\n' ' ') + echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create id: create @@ -63,8 +63,8 @@ jobs: 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 From 4aad288dba08d5b1d9b848df51846d47cd09663b Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 14:02:32 +0000 Subject: [PATCH 038/172] Edited the description of jira ticket to diaplay all PR's --- .github/workflows/dependabot-pr-to-jira.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index b8541cf..31f436f 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -29,11 +29,11 @@ jobs: run: | gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --author dependabot[bot] --json number,title,headRefName --jq '.[] | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json - - name: Format PRs for Jira description - id: format-prs - run: | - PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | select(type == "object") | "- PR #\(.number): \(.title) (branch: \(.head))"' | tr '\n' ' ') - echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV + - name: Format PRs for Jira description + id: format-prs + run: | + PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | select(type == "object") | "- PR #\(.number): \(.title) (branch: \(.head))"' | tr '\n' ' ') + echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create id: create @@ -41,7 +41,7 @@ jobs: with: project: 'ND' issuetype: 'Story' - summary: 'Dependabot PRs for ${{ github.repository_url }}' + summary: 'Dependabot PRs for ministryofjustice/nvvs-devops-github-actions' description: | {panel} *Dependabot PRs:* From 450e3af68bc681422b89b2981a70a1fa4a56ddc1 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 14:17:23 +0000 Subject: [PATCH 039/172] Edited the description of jira ticket to diaplay all PR's --- .github/workflows/dependabot-pr-to-jira.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 31f436f..b2275e8 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -28,6 +28,8 @@ jobs: GH_TOKEN: ${{ github.token }} run: | gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --author dependabot[bot] --json number,title,headRefName --jq '.[] | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json + echo "gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --author dependabot[bot] --json number,title,headRefName --jq '.[] | {number: .number, title: .title, head: .headRefName}'" + - name: Format PRs for Jira description id: format-prs From 1e12433a57f384aafd2c3906890b84965b7bb593 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 14:40:11 +0000 Subject: [PATCH 040/172] Edited the description of jira ticket to diaplay all PR's --- .github/workflows/dependabot-pr-to-jira.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index b2275e8..358116a 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,14 +27,12 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --author dependabot[bot] --json number,title,headRefName --jq '.[] | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json - echo "gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --author dependabot[bot] --json number,title,headRefName --jq '.[] | {number: .number, title: .title, head: .headRefName}'" - + gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName --jq '.[] | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json - name: Format PRs for Jira description id: format-prs run: | - PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | select(type == "object") | "- PR #\(.number): \(.title) (branch: \(.head))"' | tr '\n' ' ') + PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | select(type == "object") | "- PR #\(.number): \(.title) (.author) (branch: \(.head))"' | tr '\n' ' ') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From 9d936dd5542614c14a402da9a744171bc5800bb1 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 14:58:40 +0000 Subject: [PATCH 041/172] Updated tyhe PR's display format --- .github/workflows/dependabot-pr-to-jira.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 358116a..e624539 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,12 +27,12 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName --jq '.[] | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json - + gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot" and .author.is_bot) | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json - name: Format PRs for Jira description id: format-prs run: | - PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | select(type == "object") | "- PR #\(.number): \(.title) (.author) (branch: \(.head))"' | tr '\n' ' ') + # PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | select(type == "object") | "- PR #\(.number): \(.title) (branch: \(.head))"' | tr '\n' ' ') + PR_DESCRIPTION=$cat dependabot-prs.json echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From 20dd07b217765a50197bf4dc2ec4b4b960f5af66 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 15:00:07 +0000 Subject: [PATCH 042/172] Updated tyhe PR's display format --- .github/workflows/dependabot-pr-to-jira.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index e624539..1081445 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -28,6 +28,7 @@ jobs: GH_TOKEN: ${{ github.token }} run: | gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot" and .author.is_bot) | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json + - name: Format PRs for Jira description id: format-prs run: | From fdc243bca90ae3b6b791d9bddb017e90c9f33a78 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 15:03:09 +0000 Subject: [PATCH 043/172] corrected tyhe trigger error --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 51cad98..79a4be4 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -7,10 +7,10 @@ on: jobs: call-workflow-dependabot-pr-to-jira: - if: github.ref == 'refs/heads/ND-271-spike-dependabot-ticket-auto-creation-in-jira' + if: ${{ github.ref == 'refs/heads/ND-271-spike-dependabot-ticket-auto-creation-in-jira' }} uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira - 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 }} - + with: + 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 }} \ No newline at end of file From 5d9f2a773e7ca48d08e58e824e9b469de5ed36a1 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 15:06:57 +0000 Subject: [PATCH 044/172] corrected the error on line 31 --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 1081445..aaa3347 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -29,7 +29,7 @@ jobs: run: | gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot" and .author.is_bot) | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json - - name: Format PRs for Jira description + - name: Format PRs for Jira ticket Description id: format-prs run: | # PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | select(type == "object") | "- PR #\(.number): \(.title) (branch: \(.head))"' | tr '\n' ' ') From 74cd585524dc3bf928dba1f6954f6562bb69f901 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 15:11:02 +0000 Subject: [PATCH 045/172] corrected the error on line 31 --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index aaa3347..e57c45e 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -33,7 +33,7 @@ jobs: id: format-prs run: | # PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | select(type == "object") | "- PR #\(.number): \(.title) (branch: \(.head))"' | tr '\n' ' ') - PR_DESCRIPTION=$cat dependabot-prs.json + PR_DESCRIPTION=$(cat dependabot-prs.json) echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From 807214cdb732c3a5651b06e00f0db8ec179bcfcb Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 15:12:03 +0000 Subject: [PATCH 046/172] corrected the error on line 31 --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 79a4be4..3a62ca0 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -9,8 +9,7 @@ jobs: call-workflow-dependabot-pr-to-jira: if: ${{ github.ref == 'refs/heads/ND-271-spike-dependabot-ticket-auto-creation-in-jira' }} uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira - with: - secrets: + 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 }} \ No newline at end of file From 534ee33a61291fb6ed68bd6f73d215b1ae9e2d7b Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 15:16:38 +0000 Subject: [PATCH 047/172] corrected the error on line 31 --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 3a62ca0..1ca71ce 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -7,9 +7,9 @@ on: jobs: call-workflow-dependabot-pr-to-jira: - if: ${{ github.ref == 'refs/heads/ND-271-spike-dependabot-ticket-auto-creation-in-jira' }} + if: github.ref == 'refs/heads/ND-271-spike-dependabot-ticket-auto-creation-in-jira' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira 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 }} \ No newline at end of file + 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 }} \ No newline at end of file From 4ec109a55166cf6b329c06ccc23f19d0681800df Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 17:11:12 +0000 Subject: [PATCH 048/172] corrected the error on line 31 --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 1ca71ce..f87a865 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -7,7 +7,6 @@ on: jobs: call-workflow-dependabot-pr-to-jira: - if: github.ref == 'refs/heads/ND-271-spike-dependabot-ticket-auto-creation-in-jira' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From b3e2ea1459bebba4b85711802eddb9dba7311820 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 17:26:45 +0000 Subject: [PATCH 049/172] corrected the error on line 31 --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index f87a865..de9b7f3 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -4,6 +4,9 @@ on: push: branches: - ND-271-spike-dependabot-ticket-auto-creation-in-jira + pull_request: + branches: + - main jobs: call-workflow-dependabot-pr-to-jira: From f3f117f0c3e297d4ea34d05ff6e4bff3adf5c9c6 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 17:47:05 +0000 Subject: [PATCH 050/172] corrected the error on line 31 --- .github/workflows/dependabot-pr-to-jira.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index e57c45e..575b817 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,7 +27,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot" and .author.is_bot) | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json + # gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot" and .author.is_bot) | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json - name: Format PRs for Jira ticket Description id: format-prs @@ -64,8 +64,6 @@ jobs: 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 From ba125598ebf5da4b55e8a5d0e759cee0c6fbdf79 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 17:50:43 +0000 Subject: [PATCH 051/172] corrected the error on line 31 --- .github/workflows/dependabot-pr-to-jira.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 575b817..622d6a4 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,12 +27,11 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - # gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot" and .author.is_bot) | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json + gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot" and .author.is_bot) | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json - name: Format PRs for Jira ticket Description id: format-prs run: | - # PR_DESCRIPTION=$(cat dependabot-prs.json | jq -r '.[] | select(type == "object") | "- PR #\(.number): \(.title) (branch: \(.head))"' | tr '\n' ' ') PR_DESCRIPTION=$(cat dependabot-prs.json) echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV From f035af4f01a41e4b9eab0d4cb0d0671028ae27bc Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 17:58:13 +0000 Subject: [PATCH 052/172] corrected the errors --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 4 +--- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index de9b7f3..1ca71ce 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -4,12 +4,10 @@ on: push: branches: - ND-271-spike-dependabot-ticket-auto-creation-in-jira - pull_request: - branches: - - main jobs: call-workflow-dependabot-pr-to-jira: + if: github.ref == 'refs/heads/ND-271-spike-dependabot-ticket-auto-creation-in-jira' uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira secrets: TECH_SERVICES_JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 622d6a4..db0b545 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -32,7 +32,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(cat dependabot-prs.json) + PR_DESCRIPTION=$(cat dependabot-prs.json | jq -sRr @json) echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From 2649175d3c70b96a020f318241f1ad92a2fc04f6 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 18:13:10 +0000 Subject: [PATCH 053/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index db0b545..e4a1cc0 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -32,7 +32,8 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(cat dependabot-prs.json | jq -sRr @json) + PR_TABLE=$(jq -r '.[] | "\(.number)\(.title)\(.head)"' dependabot-prs.json | tr '\n' ' ') + PR_DESCRIPTION="${PR_TABLE}
PR NumberTitleBranch
" echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create @@ -55,14 +56,16 @@ jobs: uses: actions/github-script@v7 with: script: | - const prs = $(cat dependabot-prs.json); + const prs = JSON.parse(require('fs').readFileSync('dependabot-prs.json', 'utf8')); prs.forEach(pr => { - const number = pr.number; - github.rest.issues.createComment({ - issue_number: number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `${{ steps.create.outputs.issue }} created on Jira board and transitioned to backlog` + const number = pr.number; + github.rest.issues.createComment({ + issue_number: 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 From 656a12ea29c3990abec2279e67e5eae00a72b61e Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 18:17:05 +0000 Subject: [PATCH 054/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index e4a1cc0..a59b421 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -32,7 +32,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_TABLE=$(jq -r '.[] | "\(.number)\(.title)\(.head)"' dependabot-prs.json | tr '\n' ' ') + PR_TABLE=$(jq -r '. | "\(.number)\(.title)\(.head)"' dependabot-prs.json | tr '\n' ' ') PR_DESCRIPTION="${PR_TABLE}
PR NumberTitleBranch
" echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV From 8dac977da38fb72fd552ab14aeb1d7aa3a2a0b2c Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 18:20:16 +0000 Subject: [PATCH 055/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index a59b421..1d33f80 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -32,8 +32,8 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_TABLE=$(jq -r '. | "\(.number)\(.title)\(.head)"' dependabot-prs.json | tr '\n' ' ') - PR_DESCRIPTION="${PR_TABLE}
PR NumberTitleBranch
" + PR_DETAILS=$(jq -r '.[] | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.head)"' dependabot-prs.json | tr '\n' ' ') + PR_DESCRIPTION="Dependabot PRs:\n\n${PR_DETAILS}" echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From b4efb6df909ac73028bcbdf3cc13ca30bffb7f99 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 18:21:40 +0000 Subject: [PATCH 056/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 1d33f80..855f03a 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -32,7 +32,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DETAILS=$(jq -r '.[] | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.head)"' dependabot-prs.json | tr '\n' ' ') + PR_DETAILS=$(jq -r '.[] | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(..headRefName)"' dependabot-prs.json | tr '\n' ' ') PR_DESCRIPTION="Dependabot PRs:\n\n${PR_DETAILS}" echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV From b6cdf6eb7a3866ca035c3acdd7c9212a05407852 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 18:32:38 +0000 Subject: [PATCH 057/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 855f03a..86c70a1 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,12 +27,11 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot" and .author.is_bot) | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json - + gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author,createdAt --jq '.[] | select(.author.login == "app/dependabot" and .author.type == "Bot") | {number: .number, title: .title, head: .headRefName, url: .url, author: .author.login, date_raised: .createdAt}' > dependabot-prs.json - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DETAILS=$(jq -r '.[] | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(..headRefName)"' dependabot-prs.json | tr '\n' ' ') + PR_DETAILS=$(jq -r '.[] | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' dependabot-prs.json | tr '\n' ' ') PR_DESCRIPTION="Dependabot PRs:\n\n${PR_DETAILS}" echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV From 3444356912e039b25accab46346d4bf71470c4b5 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 18:40:30 +0000 Subject: [PATCH 058/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 86c70a1..1a98597 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -25,9 +25,14 @@ jobs: - name: List open Dependabot PRs on main branch env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author,createdAt --jq '.[] | select(.author.login == "app/dependabot" and .author.type == "Bot") | {number: .number, title: .title, head: .headRefName, url: .url, author: .author.login, date_raised: .createdAt}' > dependabot-prs.json + gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json + + - name: Verify JSON format + run: | + cat dependabot-prs.json | jq empty || exit 1 + - name: Format PRs for Jira ticket Description id: format-prs run: | @@ -51,11 +56,19 @@ jobs: - name: Log created issue run: echo "Issue ${{ steps.create.outputs.issue }} was created" - - name: Comment on GitHub + - name: Comment on github uses: actions/github-script@v7 with: script: | - const prs = JSON.parse(require('fs').readFileSync('dependabot-prs.json', 'utf8')); + const fs = require('fs'); + let prs; + try { + const data = fs.readFileSync('dependabot-prs.json', 'utf8'); + prs = JSON.parse(data); + } catch (error) { + core.setFailed(`Failed to read or parse dependabot-prs.json: ${error.message}`); + return; + } prs.forEach(pr => { const number = pr.number; github.rest.issues.createComment({ From 45a04247a7efb739c4cc3f9b6e5f8ee9770afd79 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 18:52:55 +0000 Subject: [PATCH 059/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 1a98597..32de39f 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -36,8 +36,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DETAILS=$(jq -r '.[] | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' dependabot-prs.json | tr '\n' ' ') - PR_DESCRIPTION="Dependabot PRs:\n\n${PR_DETAILS}" + PR_DESCRIPTION=$(jq -r '"* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.head)"' dependabot-prs.json) echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From c748008c86d15176650130a0a200607e9371da2c Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 18:59:45 +0000 Subject: [PATCH 060/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 32de39f..2b88c5b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,8 +27,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | {number: .number, title: .title, head: .headRefName}' > dependabot-prs.json - + gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' | sed 's/"/\\"/g' - name: Verify JSON format run: | cat dependabot-prs.json | jq empty || exit 1 @@ -36,8 +35,8 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '"* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.head)"' dependabot-prs.json) - echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV + PR_DESCRIPTION=$(jq -r '"* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.head)"' dependabot-prs.json | sed 's/"/\\"/g') + echo "PR_DESCRIPTION=\"$PR_DESCRIPTION\"" >> $GITHUB_ENV - name: Create id: create From 1be7bd4c9f34c7b5159447be368a7f60f9204b3e Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 19:08:24 +0000 Subject: [PATCH 061/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 2b88c5b..5429ce6 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -23,19 +23,12 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} - - name: List open Dependabot PRs on main branch + - name: Get list of open Dependabot PRs on main branch and format PRs for Jira ticket Description + id: format-prs env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' | sed 's/"/\\"/g' - - name: Verify JSON format - run: | - cat dependabot-prs.json | jq empty || exit 1 - - - name: Format PRs for Jira ticket Description - id: format-prs - run: | - PR_DESCRIPTION=$(jq -r '"* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.head)"' dependabot-prs.json | sed 's/"/\\"/g') + PR_DESCRIPTION=$(gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' | sed 's/"/\\"/g') echo "PR_DESCRIPTION=\"$PR_DESCRIPTION\"" >> $GITHUB_ENV - name: Create From 3e61fe38aa0c0fcb6a7bec653094f9492313db62 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 19:12:09 +0000 Subject: [PATCH 062/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5429ce6..ffc461e 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -23,10 +23,8 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} - - name: Get list of open Dependabot PRs on main branch and format PRs for Jira ticket Description + - name: Format PRs for Jira ticket Description id: format-prs - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | PR_DESCRIPTION=$(gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' | sed 's/"/\\"/g') echo "PR_DESCRIPTION=\"$PR_DESCRIPTION\"" >> $GITHUB_ENV From b0abd850138b3bdd3414a08bf369e66a67d5e379 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 19:13:19 +0000 Subject: [PATCH 063/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index ffc461e..4e212df 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -25,6 +25,8 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs + env: + GH_TOKEN: ${{ github.token }} run: | PR_DESCRIPTION=$(gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' | sed 's/"/\\"/g') echo "PR_DESCRIPTION=\"$PR_DESCRIPTION\"" >> $GITHUB_ENV From 761ab53062a530c16f33c79a3857faa0e5eae281 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 19:18:19 +0000 Subject: [PATCH 064/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 4e212df..1a3291e 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -25,11 +25,11 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs - env: - GH_TOKEN: ${{ github.token }} run: | PR_DESCRIPTION=$(gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' | sed 's/"/\\"/g') - echo "PR_DESCRIPTION=\"$PR_DESCRIPTION\"" >> $GITHUB_ENV + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create id: create From 3752cb4a3d23c0e0bfe6eec3c311478919da28b4 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 19:24:47 +0000 Subject: [PATCH 065/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 44 +++++++++++---------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 1a3291e..0561c38 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,11 +27,11 @@ jobs: id: format-prs run: | PR_DESCRIPTION=$(gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' | sed 's/"/\\"/g') + echo "PR_DESCRIPTION=\"$PR_DESCRIPTION\"" >> $GITHUB_ENV env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create + - name: Create Jira Ticket id: create uses: atlassian/gajira-create@master with: @@ -43,6 +43,10 @@ jobs: *Dependabot PRs:* ${{ env.PR_DESCRIPTION }} {panel} + env: + JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} + JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} + JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - name: Log created issue run: echo "Issue ${{ steps.create.outputs.issue }} was created" @@ -50,25 +54,25 @@ jobs: - name: Comment on github uses: actions/github-script@v7 with: - script: | - const fs = require('fs'); - let prs; - try { - const data = fs.readFileSync('dependabot-prs.json', 'utf8'); - prs = JSON.parse(data); - } catch (error) { - core.setFailed(`Failed to read or parse dependabot-prs.json: ${error.message}`); - return; - } - prs.forEach(pr => { - const number = pr.number; - github.rest.issues.createComment({ - issue_number: number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `${{ steps.create.outputs.issue }} created on Jira board and transitioned to backlog` + script: | + const fs = require('fs'); + let prs; + try { + const data = fs.readFileSync('dependabot-prs.json', 'utf8'); + prs = JSON.parse(data); + } catch (error) { + core.setFailed(`Failed to read or parse dependabot-prs.json: ${error.message}`); + return; + } + prs.forEach(pr => { + const number = pr.number; + github.rest.issues.createComment({ + issue_number: 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 From 00b35b1f8ab33aeb550d79ea2c0157f971c5909a Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 19:28:18 +0000 Subject: [PATCH 066/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 0561c38..1ea002c 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -26,8 +26,8 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' | sed 's/"/\\"/g') - echo "PR_DESCRIPTION=\"$PR_DESCRIPTION\"" >> $GITHUB_ENV + PR_DESCRIPTION=$(gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/%0A/g') + echo "::set-env name=PR_DESCRIPTION::$PR_DESCRIPTION" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ad029172e0b2d114fc21766bae7f13eb80b1513c Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 19:34:39 +0000 Subject: [PATCH 067/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 1ea002c..cc47dad 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -27,7 +27,6 @@ jobs: id: format-prs run: | PR_DESCRIPTION=$(gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/%0A/g') - echo "::set-env name=PR_DESCRIPTION::$PR_DESCRIPTION" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -41,7 +40,7 @@ jobs: description: | {panel} *Dependabot PRs:* - ${{ env.PR_DESCRIPTION }} + ${{ steps.format-prs.outputs.pr_description }} {panel} env: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} From ea56558bd77fff1624160edfda149fa1c0ea05fe Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 19:42:02 +0000 Subject: [PATCH 068/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 53 +++++++++------------ 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index cc47dad..f1ecb4e 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -23,14 +23,20 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + - name: List open Dependabot PRs on main branch + id: list-prs + env: + GH_TOKEN: ${{ github.token }} + run: | + gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot" and .author.is_bot)' > pr_list.json + - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot") | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/%0A/g') - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_DESCRIPTION=$(jq -r '.[] | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') + echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - - name: Create Jira Ticket + - name: Create id: create uses: atlassian/gajira-create@master with: @@ -40,42 +46,29 @@ jobs: description: | {panel} *Dependabot PRs:* - ${{ steps.format-prs.outputs.pr_description }} + ${{ env.PR_DESCRIPTION }} {panel} - env: - JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} - JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} - JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - name: Log created issue run: echo "Issue ${{ steps.create.outputs.issue }} was created" - - name: Comment on github + - name: Comment on GitHub uses: actions/github-script@v7 with: - script: | - const fs = require('fs'); - let prs; - try { - const data = fs.readFileSync('dependabot-prs.json', 'utf8'); - prs = JSON.parse(data); - } catch (error) { - core.setFailed(`Failed to read or parse dependabot-prs.json: ${error.message}`); - return; - } - prs.forEach(pr => { - const number = pr.number; - github.rest.issues.createComment({ - issue_number: number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `${{ steps.create.outputs.issue }} created on Jira board and transitioned to backlog` - }); + script: | + const fs = require('fs'); + const prs = JSON.parse(fs.readFileSync('pr_list.json', 'utf8')); + prs.forEach(pr => { + github.rest.issues.createComment({ + issue_number: pr.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" - + transition: "Backlog" \ No newline at end of file From e9e7cf36f192c7d6678bf1758e92b24b9af991ab Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 19:47:13 +0000 Subject: [PATCH 069/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index f1ecb4e..7df512b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -28,7 +28,12 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author --jq '.[] | select(.author.login == "app/dependabot" and .author.is_bot)' > pr_list.json + gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author > pr_list.json + if ! jq -e . pr_list.json > /dev/null 2>&1; then + echo "Invalid JSON output from gh pr list" + cat pr_list.json + exit 1 + fi - name: Format PRs for Jira ticket Description id: format-prs From 6fc099c4fc315b62bb5f4d096c766d6bb51ebc1f Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 19:58:02 +0000 Subject: [PATCH 070/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 7df512b..29a5804 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -33,12 +33,11 @@ jobs: echo "Invalid JSON output from gh pr list" cat pr_list.json exit 1 - fi - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') + PR_DESCRIPTION=$(jq -r '.[] | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)\n URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From f0b99fcc41d0d72862d79faead9d063f597adf41 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 19:59:40 +0000 Subject: [PATCH 071/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 29a5804..435139d 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -33,6 +33,7 @@ jobs: echo "Invalid JSON output from gh pr list" cat pr_list.json exit 1 + fi - name: Format PRs for Jira ticket Description id: format-prs From aff2e70e47efba996d966387f94cd27568b8c269 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:10:49 +0000 Subject: [PATCH 072/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 435139d..627626e 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,7 +38,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "* PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)\n URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') + PR_DESCRIPTION=$(jq -r '.[] | "* \nPR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)\n URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create @@ -47,7 +47,7 @@ jobs: with: project: 'ND' issuetype: 'Story' - summary: 'Dependabot PRs for ministryofjustice/nvvs-devops-github-actions' + summary: 'Dependabot PRs for ${{ github.repository }}' description: | {panel} *Dependabot PRs:* From 65f25b70576fc14162abbf2eeab83185c2254d95 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:15:18 +0000 Subject: [PATCH 073/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 627626e..2b3e36d 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,7 +38,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "* \nPR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)\n URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') + PR_DESCRIPTION=$(jq -r '.[] | "* /n/nPR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From 30433d2be337a430f9dcc278be9f264780730705 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:21:38 +0000 Subject: [PATCH 074/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 2b3e36d..1400cf5 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,7 +38,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "* /n/nPR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') + PR_DESCRIPTION=$(jq -r '.[] | "* %0A PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From 1a63b125fa01fd83d4103eadd211cd179810a9de Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:22:56 +0000 Subject: [PATCH 075/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 1400cf5..12aec57 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,7 +38,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "* %0A PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') + PR_DESCRIPTION=$(jq -r '.[] | "*
PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From 0979d08128ff30e2747d6d3ab84d7d7932b698b0 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:28:07 +0000 Subject: [PATCH 076/172] Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 12aec57..4cfc688 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -28,7 +28,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh pr list --repo ministryofjustice/nvvs-devops-github-actions --base main --json number,title,headRefName,author > pr_list.json + gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName,author > pr_list.json if ! jq -e . pr_list.json > /dev/null 2>&1; then echo "Invalid JSON output from gh pr list" cat pr_list.json @@ -38,7 +38,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "*
PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') + PR_DESCRIPTION=$(jq -r '.[] | "*
PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create @@ -50,9 +50,9 @@ jobs: summary: 'Dependabot PRs for ${{ github.repository }}' description: | {panel} - *Dependabot PRs:* - ${{ env.PR_DESCRIPTION }} + *Dependabot PRs :* {panel} + ${{ env.PR_DESCRIPTION }} - name: Log created issue run: echo "Issue ${{ steps.create.outputs.issue }} was created" From eeafaf7dd9ec4e7d8167562665d224871cfaf39a Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:31:57 +0000 Subject: [PATCH 077/172] ND-271 Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 4cfc688..97c2bf0 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,7 +38,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "*
PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)\n URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json) echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From 7fe1eece3a7a8d2aa8c71cba9959a04960b0a1b1 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:33:18 +0000 Subject: [PATCH 078/172] ND-271 Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 97c2bf0..18a7ed1 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,7 +38,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)\n URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json) + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From 8926cef0afea3e9c5a3f4e79e7a5566100d60a4c Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:41:51 +0000 Subject: [PATCH 079/172] ND-271 Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 18a7ed1..8b2990b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,9 +38,8 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') + PR_DESCRIPTION=$(jq -r '.[] | select(.author.login == "app/dependabot" and .isBot == true) | "- PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)\n URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json) echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - - name: Create id: create uses: atlassian/gajira-create@master @@ -54,6 +53,16 @@ jobs: {panel} ${{ env.PR_DESCRIPTION }} + - name: Add label to created issue + run: | + issue_key="${{ steps.create.outputs.issue }}" + jira_base_url="${{ secrets.TECH_SERVICES_JIRA_URL }}" + jira_email="${{ secrets.TECH_SERVICES_JIRA_EMAIL }}" + jira_token="${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" + curl -X PUT -u "$jira_email:$jira_token" -H "Content-Type: application/json" \ + --data '{"update":{"labels":[{"set":["Dependabot"]}]}}' \ + "$jira_base_url/rest/api/3/issue/$issue_key" + - name: Log created issue run: echo "Issue ${{ steps.create.outputs.issue }} was created" From 4bb4f7644b9966e1d9c5cbfcc68f2c3708d95035 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:43:17 +0000 Subject: [PATCH 080/172] ND-271 Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 8b2990b..ad7deb7 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,7 +38,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | select(.author.login == "app/dependabot" and .isBot == true) | "- PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)\n URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json) + PR_DESCRIPTION=$(jq -r '.[] | select(.author.login == "app/dependabot") | "- PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)\n URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json) echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create id: create From 514d4a923d62cbfdd9486b1de5efba8e28d080ca Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:45:10 +0000 Subject: [PATCH 081/172] ND-271 Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index ad7deb7..e6f2e6b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -40,6 +40,7 @@ jobs: run: | PR_DESCRIPTION=$(jq -r '.[] | select(.author.login == "app/dependabot") | "- PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)\n URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json) echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV + - name: Create id: create uses: atlassian/gajira-create@master From d25acb15b50ce9defc7c78d7ac801c9725e9d916 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:46:39 +0000 Subject: [PATCH 082/172] ND-271 Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index e6f2e6b..bc49967 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,7 +38,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | select(.author.login == "app/dependabot") | "- PR Number: \(.number)\n Title: \(.title)\n Branch: \(.headRefName)\n URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json) + PR_DESCRIPTION=$(jq -r '.[] | select(.author.login == "app/dependabot") | "- PR Number: \(.number)\n Title: \(.title | gsub(":"; "\\:"))\n Branch: \(.headRefName)\n URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json) echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From 729a3e5580548bebc093837151f2cf18c57888eb Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 20:48:35 +0000 Subject: [PATCH 083/172] ND-271 Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index bc49967..8daa070 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,7 +38,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | select(.author.login == "app/dependabot") | "- PR Number: \(.number)\n Title: \(.title | gsub(":"; "\\:"))\n Branch: \(.headRefName)\n URL: https://github.com/ministryofjustice/nvvs-devops-github-actions/pull/\(.number)\n"' pr_list.json) + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Create From 8b22d22ec06f53587d422476438b8bac2fc672f4 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 21:08:53 +0000 Subject: [PATCH 084/172] ND-271 Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 58 ++++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 8daa070..6141241 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -14,7 +14,7 @@ on: jobs: check-open-prs: runs-on: ubuntu-latest - name: Create Jira Ticket + name: Create or Update Jira Ticket steps: - name: Login uses: atlassian/gajira-login@master @@ -38,34 +38,40 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/%0A/g') + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - - name: Create - id: create - uses: atlassian/gajira-create@master - with: - project: 'ND' - issuetype: 'Story' - summary: 'Dependabot PRs for ${{ github.repository }}' - description: | - {panel} - *Dependabot PRs :* - {panel} - ${{ env.PR_DESCRIPTION }} + - name: Check for existing Jira ticket with Dependabot label + id: check-ticket + run: | + response=$(curl -s -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X GET "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/search?jql=labels=Dependabot AND project=ND AND summary~'${{ github.repository }}'") + issue_key=$(echo $response | jq -r '.issues[0].key // empty') + echo "issue_key=$issue_key" >> $GITHUB_ENV - - name: Add label to created issue + - name: Create or Update Jira Ticket + id: create-update run: | - issue_key="${{ steps.create.outputs.issue }}" - jira_base_url="${{ secrets.TECH_SERVICES_JIRA_URL }}" - jira_email="${{ secrets.TECH_SERVICES_JIRA_EMAIL }}" - jira_token="${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" - curl -X PUT -u "$jira_email:$jira_token" -H "Content-Type: application/json" \ - --data '{"update":{"labels":[{"set":["Dependabot"]}]}}' \ - "$jira_base_url/rest/api/3/issue/$issue_key" + if [ -n "${{ env.issue_key }}" ]; then + echo "Updating existing Jira ticket: ${{ env.issue_key }}" + curl -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X PUT -H "Content-Type: application/json" \ + --data "{\"fields\":{\"description\":\"${{ env.PR_DESCRIPTION }}\"}}" \ + "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/issue/${{ env.issue_key }}" + else + echo "Creating new Jira ticket" + issue_key=$(curl -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X POST -H "Content-Type: application/json" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ github.repository }}\",\"description\":\"${{ env.PR_DESCRIPTION }}\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\"]}}" \ + "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/issue" | jq -r .key) + echo "issue_key=$issue_key" >> $GITHUB_ENV + fi - - name: Log created issue - run: echo "Issue ${{ steps.create.outputs.issue }} was created" + - name: Log created or updated issue + run: | + if [ -n "${{ env.issue_key }}" ]; then + echo "Issue ${{ env.issue_key }} was created or updated" + else + echo "Failed to create or update issue" + exit 1 + fi - name: Comment on GitHub uses: actions/github-script@v7 @@ -78,12 +84,12 @@ jobs: issue_number: pr.number, owner: context.repo.owner, repo: context.repo.repo, - body: `${{ steps.create.outputs.issue }} created on Jira board and transitioned to backlog` + body: `${{ env.issue_key }} created or updated on Jira board` }); }); - name: Transition issue uses: atlassian/gajira-transition@master with: - issue: ${{ steps.create.outputs.issue }} + issue: ${{ env.issue_key }} transition: "Backlog" \ No newline at end of file From 8dc8c0f02fe068fde31c375ae88231e737925d3f Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 21:11:39 +0000 Subject: [PATCH 085/172] ND-271 Updated the format of description --- .github/workflows/dependabot-pr-to-jira.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 6141241..686b247 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -45,7 +45,16 @@ jobs: id: check-ticket run: | response=$(curl -s -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X GET "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/search?jql=labels=Dependabot AND project=ND AND summary~'${{ github.repository }}'") + if [ $? -ne 0 ]; then + echo "Failed to query Jira API" + exit 1 + fi issue_key=$(echo $response | jq -r '.issues[0].key // empty') + if [ -z "$issue_key" ]; then + echo "No existing Jira ticket found" + else + echo "Found existing Jira ticket: $issue_key" + fi echo "issue_key=$issue_key" >> $GITHUB_ENV - name: Create or Update Jira Ticket From fa48cb5f6053970d7761a049b806806826a19505 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 21:16:45 +0000 Subject: [PATCH 086/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 686b247..8c2e329 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -45,6 +45,7 @@ jobs: id: check-ticket run: | response=$(curl -s -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X GET "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/search?jql=labels=Dependabot AND project=ND AND summary~'${{ github.repository }}'") + echo $response if [ $? -ne 0 ]; then echo "Failed to query Jira API" exit 1 From bf101c46a7c599ec6a6fb1c99b4079f1f006e5e2 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 21:28:50 +0000 Subject: [PATCH 087/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 8c2e329..042fd63 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -44,19 +44,13 @@ jobs: - name: Check for existing Jira ticket with Dependabot label id: check-ticket run: | - response=$(curl -s -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X GET "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/search?jql=labels=Dependabot AND project=ND AND summary~'${{ github.repository }}'") - echo $response - if [ $? -ne 0 ]; then - echo "Failed to query Jira API" - exit 1 - fi - issue_key=$(echo $response | jq -r '.issues[0].key // empty') - if [ -z "$issue_key" ]; then - echo "No existing Jira ticket found" - else - echo "Found existing Jira ticket: $issue_key" - fi - echo "issue_key=$issue_key" >> $GITHUB_ENV + issue_key=$(gh issue list --repo ${{ github.repository }} --label Dependabot --json number,title --jq '.[] | select(.title | contains("Dependabot")) | .number' | head -n 1) + if [ -z "$issue_key" ]; then + echo "No existing Jira ticket found" + else + echo "Found existing Jira ticket: $issue_key" + fi + echo "issue_key=$issue_key" >> $GITHUB_ENV - name: Create or Update Jira Ticket id: create-update @@ -98,6 +92,7 @@ jobs: }); }); + - name: Transition issue uses: atlassian/gajira-transition@master with: From 8012fdb5bfdb46d52962f0def877cf0b036f97ad Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 21:32:41 +0000 Subject: [PATCH 088/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 042fd63..9a93ea4 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -44,13 +44,13 @@ jobs: - name: Check for existing Jira ticket with Dependabot label id: check-ticket run: | - issue_key=$(gh issue list --repo ${{ github.repository }} --label Dependabot --json number,title --jq '.[] | select(.title | contains("Dependabot")) | .number' | head -n 1) - if [ -z "$issue_key" ]; then - echo "No existing Jira ticket found" - else - echo "Found existing Jira ticket: $issue_key" - fi - echo "issue_key=$issue_key" >> $GITHUB_ENV + issue_key=$(gh issue list --repo ${{ github.repository }} --label Dependabot --json number,title --jq '.[] | select(.title | contains("Dependabot")) | .number' | head -n 1) + if [ -z "$issue_key" ]; then + echo "No existing Jira ticket found" + else + echo "Found existing Jira ticket: $issue_key" + fi + echo "issue_key=$issue_key" >> $GITHUB_ENV - name: Create or Update Jira Ticket id: create-update @@ -92,9 +92,9 @@ jobs: }); }); - - name: Transition issue uses: atlassian/gajira-transition@master with: issue: ${{ env.issue_key }} - transition: "Backlog" \ No newline at end of file + transition: "Backlog" + continue-on-error: true \ No newline at end of file From 5defef689a281654bcd31a4358b5647ae02650cc Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Wed, 22 Jan 2025 21:34:45 +0000 Subject: [PATCH 089/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 9a93ea4..8ae0456 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -51,6 +51,8 @@ jobs: echo "Found existing Jira ticket: $issue_key" fi echo "issue_key=$issue_key" >> $GITHUB_ENV + env: + GH_TOKEN: ${{ github.token }} - name: Create or Update Jira Ticket id: create-update From b40b398275f129fb597860c1a6dc1f44cf30d942 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 23 Jan 2025 14:58:07 +0000 Subject: [PATCH 090/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 44 ++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 8ae0456..b13c558 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -11,6 +11,7 @@ on: description: 'A token passed from the caller workflow' required: true + jobs: check-open-prs: runs-on: ubuntu-latest @@ -23,6 +24,7 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + - name: List open Dependabot PRs on main branch id: list-prs env: @@ -35,50 +37,47 @@ jobs: exit 1 fi + - name: Format PRs for Jira ticket Description id: format-prs run: | PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV + - name: Check for existing Jira ticket with Dependabot label id: check-ticket - run: | - issue_key=$(gh issue list --repo ${{ github.repository }} --label Dependabot --json number,title --jq '.[] | select(.title | contains("Dependabot")) | .number' | head -n 1) - if [ -z "$issue_key" ]; then - echo "No existing Jira ticket found" - else - echo "Found existing Jira ticket: $issue_key" - fi - echo "issue_key=$issue_key" >> $GITHUB_ENV + uses: atlassian/gajira-get-issue@v2 + with: + jql: 'project = ND AND labels = Dependabot' env: - GH_TOKEN: ${{ github.token }} + 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 or Update Jira Ticket id: create-update run: | - if [ -n "${{ env.issue_key }}" ]; then - echo "Updating existing Jira ticket: ${{ env.issue_key }}" - curl -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X PUT -H "Content-Type: application/json" \ - --data "{\"fields\":{\"description\":\"${{ env.PR_DESCRIPTION }}\"}}" \ - "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/issue/${{ env.issue_key }}" + if [ -n "${{ steps.check-ticket.outputs.issue }}" ]; then + echo "Updating existing Jira ticket: ${{ steps.check-ticket.outputs.issue }}" + jira issue update --issue ${{ steps.check-ticket.outputs.issue }} --description "${{ env.PR_DESCRIPTION }}" else echo "Creating new Jira ticket" - issue_key=$(curl -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X POST -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ github.repository }}\",\"description\":\"${{ env.PR_DESCRIPTION }}\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\"]}}" \ - "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/issue" | jq -r .key) - echo "issue_key=$issue_key" >> $GITHUB_ENV + jira issue create --project ND --summary "Dependabot PRs for ${{ github.repository }}" --description "${{ env.PR_DESCRIPTION }}" --issuetype Story --labels Dependabot fi + - name: Log created or updated issue run: | - if [ -n "${{ env.issue_key }}" ]; then - echo "Issue ${{ env.issue_key }} was created or updated" + if [ -n "${{ steps.create-update.outputs.issue }}" ]; then + echo "Issue ${{ steps.create-update.outputs.issue }} was created or updated" else echo "Failed to create or update issue" exit 1 fi + - name: Comment on GitHub uses: actions/github-script@v7 with: @@ -90,13 +89,14 @@ jobs: issue_number: pr.number, owner: context.repo.owner, repo: context.repo.repo, - body: `${{ env.issue_key }} created or updated on Jira board` + body: `${{ steps.create-update.outputs.issue }} created or updated on Jira board` }); }); + - name: Transition issue uses: atlassian/gajira-transition@master with: - issue: ${{ env.issue_key }} + issue: ${{ steps.create-update.outputs.issue }} transition: "Backlog" continue-on-error: true \ No newline at end of file From d75c2f167bc9ffa99293dde70e958a807c78d7db Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 23 Jan 2025 16:56:00 +0000 Subject: [PATCH 091/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 44 ++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index b13c558..8ae0456 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -11,7 +11,6 @@ on: description: 'A token passed from the caller workflow' required: true - jobs: check-open-prs: runs-on: ubuntu-latest @@ -24,7 +23,6 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} - - name: List open Dependabot PRs on main branch id: list-prs env: @@ -37,47 +35,50 @@ jobs: exit 1 fi - - name: Format PRs for Jira ticket Description id: format-prs run: | PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - - name: Check for existing Jira ticket with Dependabot label id: check-ticket - uses: atlassian/gajira-get-issue@v2 - with: - jql: 'project = ND AND labels = Dependabot' + run: | + issue_key=$(gh issue list --repo ${{ github.repository }} --label Dependabot --json number,title --jq '.[] | select(.title | contains("Dependabot")) | .number' | head -n 1) + if [ -z "$issue_key" ]; then + echo "No existing Jira ticket found" + else + echo "Found existing Jira ticket: $issue_key" + fi + echo "issue_key=$issue_key" >> $GITHUB_ENV 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 }} - + GH_TOKEN: ${{ github.token }} - name: Create or Update Jira Ticket id: create-update run: | - if [ -n "${{ steps.check-ticket.outputs.issue }}" ]; then - echo "Updating existing Jira ticket: ${{ steps.check-ticket.outputs.issue }}" - jira issue update --issue ${{ steps.check-ticket.outputs.issue }} --description "${{ env.PR_DESCRIPTION }}" + if [ -n "${{ env.issue_key }}" ]; then + echo "Updating existing Jira ticket: ${{ env.issue_key }}" + curl -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X PUT -H "Content-Type: application/json" \ + --data "{\"fields\":{\"description\":\"${{ env.PR_DESCRIPTION }}\"}}" \ + "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/issue/${{ env.issue_key }}" else echo "Creating new Jira ticket" - jira issue create --project ND --summary "Dependabot PRs for ${{ github.repository }}" --description "${{ env.PR_DESCRIPTION }}" --issuetype Story --labels Dependabot + issue_key=$(curl -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X POST -H "Content-Type: application/json" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ github.repository }}\",\"description\":\"${{ env.PR_DESCRIPTION }}\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\"]}}" \ + "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/issue" | jq -r .key) + echo "issue_key=$issue_key" >> $GITHUB_ENV fi - - name: Log created or updated issue run: | - if [ -n "${{ steps.create-update.outputs.issue }}" ]; then - echo "Issue ${{ steps.create-update.outputs.issue }} was created or updated" + if [ -n "${{ env.issue_key }}" ]; then + echo "Issue ${{ env.issue_key }} was created or updated" else echo "Failed to create or update issue" exit 1 fi - - name: Comment on GitHub uses: actions/github-script@v7 with: @@ -89,14 +90,13 @@ jobs: issue_number: pr.number, owner: context.repo.owner, repo: context.repo.repo, - body: `${{ steps.create-update.outputs.issue }} created or updated on Jira board` + body: `${{ env.issue_key }} created or updated on Jira board` }); }); - - name: Transition issue uses: atlassian/gajira-transition@master with: - issue: ${{ steps.create-update.outputs.issue }} + issue: ${{ env.issue_key }} transition: "Backlog" continue-on-error: true \ No newline at end of file From df8b61fa2461a1647b7496529c3737c444f3fac0 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 23 Jan 2025 17:24:56 +0000 Subject: [PATCH 092/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 8ae0456..8a453f2 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -41,6 +41,30 @@ jobs: PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV + - name: Create + id: create + uses: atlassian/gajira-create@master + with: + project: 'ND' + issuetype: 'Story' + summary: 'ND- Dependabot PRs for ${{ github.repository }}' + description: | + {panel} + *Dependabot PRs :* + {panel} + ${{ env.PR_DESCRIPTION }} + + - name: Find Jira Issue Key + uses: atlassian/gajira-find-issue-key@v2 + id: find-issue + with: + project: 'ND' + pattern: 'Dep*' # Regex pattern to match issue keys (e.g., .* to match all) + + - name: Show Jira Issue Key + run: | + echo "Found Jira issue key: ${{ steps.find-issue.outputs.issue_key }}" + - name: Check for existing Jira ticket with Dependabot label id: check-ticket run: | From 3987076542364310be2444a3f2c486a275ae9fa6 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 23 Jan 2025 17:27:01 +0000 Subject: [PATCH 093/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 8a453f2..5b45d9a 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -55,11 +55,11 @@ jobs: ${{ env.PR_DESCRIPTION }} - name: Find Jira Issue Key - uses: atlassian/gajira-find-issue-key@v2 + uses: atlassian/gajira-find-issue-key@v3 id: find-issue with: project: 'ND' - pattern: 'Dep*' # Regex pattern to match issue keys (e.g., .* to match all) + pattern: 'ND-' # Regex pattern to match issue keys (e.g., .* to match all) - name: Show Jira Issue Key run: | From 21314abc5572bb51276542ae28c85b4b9ca9881d Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 23 Jan 2025 23:04:17 +0000 Subject: [PATCH 094/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5b45d9a..25007b3 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -47,7 +47,7 @@ jobs: with: project: 'ND' issuetype: 'Story' - summary: 'ND- Dependabot PRs for ${{ github.repository }}' + summary: 'Dependabot PRs for ${{ github.repository }}' description: | {panel} *Dependabot PRs :* @@ -59,7 +59,7 @@ jobs: id: find-issue with: project: 'ND' - pattern: 'ND-' # Regex pattern to match issue keys (e.g., .* to match all) + pattern: '.*' # Regex pattern to match issue keys (e.g., .* to match all) - name: Show Jira Issue Key run: | From 30800eebf24d9a292913da8d2f791f819dd08ccd Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 23 Jan 2025 23:13:00 +0000 Subject: [PATCH 095/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 31 +++++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 25007b3..5338df5 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -54,12 +54,31 @@ jobs: {panel} ${{ env.PR_DESCRIPTION }} - - name: Find Jira Issue Key - uses: atlassian/gajira-find-issue-key@v3 - id: find-issue - with: - project: 'ND' - pattern: '.*' # Regex pattern to match issue keys (e.g., .* to match all) + - name: Get Jira Issue with Dependabot Label + 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 }} + run: | + echo "Searching for issues with the 'dependabot' label..." + + # Define JQL query to find issues with the 'dependabot' label + JQL_QUERY='labels="dependabot"' + + # Make API request to Jira to search for issues with the given label + response=$(curl -s -u $JIRA_USER_EMAIL:$JIRA_API_TOKEN \ + -X GET \ + -H "Content-Type: application/json" \ + "$JIRA_BASE_URL/rest/api/2/search?jql=$JQL_QUERY") + + # Extract the issue keys from the response (this is a simple example, assuming there's at least one result) + issue_keys=$(echo $response | jq -r '.issues[0].key') + + if [ -z "$issue_keys" ]; then + echo "No issues found with the 'dependabot' label." + else + echo "Found Jira issue(s) with dependabot label: $issue_keys" + fi - name: Show Jira Issue Key run: | From 1c8ee11883d2e3b2dd539de558608a783e4c2623 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Thu, 23 Jan 2025 23:20:53 +0000 Subject: [PATCH 096/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 65 ++++++++++++++------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5338df5..72e150b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -54,31 +54,52 @@ jobs: {panel} ${{ env.PR_DESCRIPTION }} - - name: Get Jira Issue with Dependabot Label + - name: Get Jira Issues with Dependabot Label in Project ND env: - JIRA_BASE_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} - JIRA_USER_EMAIL: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} + JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} run: | - echo "Searching for issues with the 'dependabot' label..." - - # Define JQL query to find issues with the 'dependabot' label - JQL_QUERY='labels="dependabot"' - - # Make API request to Jira to search for issues with the given label - response=$(curl -s -u $JIRA_USER_EMAIL:$JIRA_API_TOKEN \ - -X GET \ - -H "Content-Type: application/json" \ - "$JIRA_BASE_URL/rest/api/2/search?jql=$JQL_QUERY") - - # Extract the issue keys from the response (this is a simple example, assuming there's at least one result) - issue_keys=$(echo $response | jq -r '.issues[0].key') - - if [ -z "$issue_keys" ]; then - echo "No issues found with the 'dependabot' label." - else - echo "Found Jira issue(s) with dependabot label: $issue_keys" - fi + echo "Searching for issues with the 'dependabot' label in project 'ND'..." + + # Define JQL query to find issues with the 'dependabot' label in the 'ND' project + JQL_QUERY='project="ND" AND labels="dependabot"' + + # Make API request to Jira to search for issues with the given label in the 'ND' project + response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X GET \ + -H "Content-Type: application/json" \ + "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") + + # Extract all issue keys from the response (loop through all issues) + issue_keys=$(echo $response | jq -r '.issues[].key') + + if [ -z "$issue_keys" ]; then + echo "No issues found with the 'dependabot' label in project 'ND'." + else + # Iterate over all found issue keys and update each one + echo "Found Jira issue(s) with dependabot label:" + for issue_key in $issue_keys; do + echo "Updating description of issue $issue_key..." + + # Prepare the updated description (you can customize the description text) + NEW_DESCRIPTION="This issue has been updated due to Dependabot's automated changes." + + # Use Jira API to update the description of each found issue + update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X PUT \ + -H "Content-Type: application/json" \ + -d '{ + "fields": { + "description": "'"$NEW_DESCRIPTION"'" + } + }' \ + "$JIRA_URL/rest/api/2/issue/$issue_key") + + # Check the response for success (this part can be customized based on your needs) + echo "Description updated for issue $issue_key." + done + fi - name: Show Jira Issue Key run: | From eb39fbf9b241e853d21d9506258b18c1956670bb Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Sun, 26 Jan 2025 23:34:54 +0000 Subject: [PATCH 097/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 141 ++++++++------------ 1 file changed, 54 insertions(+), 87 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 72e150b..a7677e2 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -41,103 +41,70 @@ jobs: PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - - name: Create - id: create - uses: atlassian/gajira-create@master - with: - project: 'ND' - issuetype: 'Story' - summary: 'Dependabot PRs for ${{ github.repository }}' - description: | - {panel} - *Dependabot PRs :* - {panel} - ${{ env.PR_DESCRIPTION }} - name: Get Jira Issues with Dependabot Label in Project ND env: - JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} - JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} - JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} - run: | - echo "Searching for issues with the 'dependabot' label in project 'ND'..." - - # Define JQL query to find issues with the 'dependabot' label in the 'ND' project - JQL_QUERY='project="ND" AND labels="dependabot"' - - # Make API request to Jira to search for issues with the given label in the 'ND' project - response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ - -X GET \ - -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") - - # Extract all issue keys from the response (loop through all issues) - issue_keys=$(echo $response | jq -r '.issues[].key') - - if [ -z "$issue_keys" ]; then - echo "No issues found with the 'dependabot' label in project 'ND'." - else - # Iterate over all found issue keys and update each one - echo "Found Jira issue(s) with dependabot label:" - for issue_key in $issue_keys; do - echo "Updating description of issue $issue_key..." - - # Prepare the updated description (you can customize the description text) - NEW_DESCRIPTION="This issue has been updated due to Dependabot's automated changes." - - # Use Jira API to update the description of each found issue - update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ - -X PUT \ - -H "Content-Type: application/json" \ - -d '{ - "fields": { - "description": "'"$NEW_DESCRIPTION"'" - } - }' \ - "$JIRA_URL/rest/api/2/issue/$issue_key") - - # Check the response for success (this part can be customized based on your needs) - echo "Description updated for issue $issue_key." - done - fi - - - name: Show Jira Issue Key + JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} + JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} run: | - echo "Found Jira issue key: ${{ steps.find-issue.outputs.issue_key }}" + echo "Searching for issues with the 'dependabot' label in project 'ND'..." - - name: Check for existing Jira ticket with Dependabot label - id: check-ticket - run: | - issue_key=$(gh issue list --repo ${{ github.repository }} --label Dependabot --json number,title --jq '.[] | select(.title | contains("Dependabot")) | .number' | head -n 1) - if [ -z "$issue_key" ]; then - echo "No existing Jira ticket found" - else - echo "Found existing Jira ticket: $issue_key" - fi - echo "issue_key=$issue_key" >> $GITHUB_ENV - env: - GH_TOKEN: ${{ github.token }} + # Define JQL query to find issues with the 'dependabot' label in the 'ND' project + JQL_QUERY='project="ND" AND labels="dependabot"' - - name: Create or Update Jira Ticket - id: create-update - run: | - if [ -n "${{ env.issue_key }}" ]; then - echo "Updating existing Jira ticket: ${{ env.issue_key }}" - curl -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X PUT -H "Content-Type: application/json" \ - --data "{\"fields\":{\"description\":\"${{ env.PR_DESCRIPTION }}\"}}" \ - "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/issue/${{ env.issue_key }}" + # Make API request to Jira to search for issues with the given label in the 'ND' project + response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X GET \ + -H "Content-Type: application/json" \ + "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") + + # Include new curl POST request for Jira autocomplete data + curl --request POST \ + --url 'https://dsdmoj.atlassian.net/rest/api/3/jql/autocompletedata' \ + --user "$JIRA_USERNAME:$JIRA_API_TOKEN" \ + --header 'Accept: application/json' \ + --header 'Content-Type: application/json' \ + --data '{ + "includeCollapsedFields": true, + "projectIds": ["ND"] + }' + + # Extract all issue keys from the response (loop through all issues) + issue_keys=$(echo $response | jq -r '.issues[].key') + + if [ -z "$issue_keys" ]; then + echo "No issues found with the 'dependabot' label in project 'ND'." else - echo "Creating new Jira ticket" - issue_key=$(curl -u "${{ secrets.TECH_SERVICES_JIRA_EMAIL }}:${{ secrets.TECH_SERVICES_JIRA_TOKEN }}" -X POST -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ github.repository }}\",\"description\":\"${{ env.PR_DESCRIPTION }}\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\"]}}" \ - "${{ secrets.TECH_SERVICES_JIRA_URL }}/rest/api/3/issue" | jq -r .key) - echo "issue_key=$issue_key" >> $GITHUB_ENV + # Iterate over all found issue keys and update each one + echo "Found Jira issue(s) with dependabot label:" + echo "ISSUE_KEYS=$ISSUE_KEYS" >> $GITHUB_ENV + for issue_key in $issue_keys; do + echo "Updating description of issue $issue_key..." + + # Prepare the updated description (you can customize the description text) + NEW_DESCRIPTION="This issue has been updated due to Dependabot's automated changes." + + # Use Jira API to update the description of each found issue + update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X PUT \ + -H "Content-Type: application/json" \ + -d '{ + "fields": { + "description": "'"$NEW_DESCRIPTION"'" + } + }' \ + "$JIRA_URL/rest/api/2/issue/$issue_key") + + # Check the response for success (this part can be customized based on your needs) + echo "Description updated for issue $issue_key." + done fi - name: Log created or updated issue run: | - if [ -n "${{ env.issue_key }}" ]; then - echo "Issue ${{ env.issue_key }} was created or updated" + if [ -n "${{ env.ISSUE_KEYS }}" ]; then + echo "Issue ${{ env.ISSUE_KEYS }} was created or updated" else echo "Failed to create or update issue" exit 1 @@ -154,7 +121,7 @@ jobs: issue_number: pr.number, owner: context.repo.owner, repo: context.repo.repo, - body: `${{ env.issue_key }} created or updated on Jira board` + body: `${{ env.ISSUE_KEYS }} created or updated on Jira board` }); }); From dd38410f1909f113eff3b3a817285fc7feddcc3c Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Sun, 26 Jan 2025 23:42:24 +0000 Subject: [PATCH 098/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 61 +++------------------ 1 file changed, 9 insertions(+), 52 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index a7677e2..8ae5b8b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -41,65 +41,22 @@ jobs: PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - - - name: Get Jira Issues with Dependabot Label in Project ND - env: - JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} - JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} - JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} + - name: Search Jira tickets run: | - echo "Searching for issues with the 'dependabot' label in project 'ND'..." - - # Define JQL query to find issues with the 'dependabot' label in the 'ND' project - JQL_QUERY='project="ND" AND labels="dependabot"' - - # Make API request to Jira to search for issues with the given label in the 'ND' project - response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ - -X GET \ - -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") - - # Include new curl POST request for Jira autocomplete data curl --request POST \ - --url 'https://dsdmoj.atlassian.net/rest/api/3/jql/autocompletedata' \ + --url 'https://dsdmoj.atlassian.net/rest/api/3/search' \ --user "$JIRA_USERNAME:$JIRA_API_TOKEN" \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ - "includeCollapsedFields": true, - "projectIds": ["ND"] - }' - - # Extract all issue keys from the response (loop through all issues) - issue_keys=$(echo $response | jq -r '.issues[].key') - - if [ -z "$issue_keys" ]; then - echo "No issues found with the 'dependabot' label in project 'ND'." - else - # Iterate over all found issue keys and update each one - echo "Found Jira issue(s) with dependabot label:" - echo "ISSUE_KEYS=$ISSUE_KEYS" >> $GITHUB_ENV - for issue_key in $issue_keys; do - echo "Updating description of issue $issue_key..." - - # Prepare the updated description (you can customize the description text) - NEW_DESCRIPTION="This issue has been updated due to Dependabot's automated changes." - - # Use Jira API to update the description of each found issue - update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ - -X PUT \ - -H "Content-Type: application/json" \ - -d '{ - "fields": { - "description": "'"$NEW_DESCRIPTION"'" - } - }' \ - "$JIRA_URL/rest/api/2/issue/$issue_key") + "jql": "project = ND AND labels = dependabot", + "fields": ["key", "summary", "labels"] + }' > jira_ticket.json + echo "Jira tickets: $(cat jira_ticket.json)" + env: + JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }} + JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - # Check the response for success (this part can be customized based on your needs) - echo "Description updated for issue $issue_key." - done - fi - name: Log created or updated issue run: | From 5c92ebfb25ad021617b171f7837e74ab65a6114f Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Sun, 26 Jan 2025 23:46:19 +0000 Subject: [PATCH 099/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 28 ++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 8ae5b8b..03209b5 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -41,27 +41,37 @@ jobs: PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - - name: Search Jira tickets + - name: Search Jira tickets and set ISSUE_TYPES run: | - curl --request POST \ + # Run the Jira API call to fetch issues + response=$(curl --request POST \ --url 'https://dsdmoj.atlassian.net/rest/api/3/search' \ --user "$JIRA_USERNAME:$JIRA_API_TOKEN" \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "jql": "project = ND AND labels = dependabot", - "fields": ["key", "summary", "labels"] - }' > jira_ticket.json - echo "Jira tickets: $(cat jira_ticket.json)" + "fields": ["key", "issuetype"] + }') + + # Parse the issue types from the JSON response using jq + issue_types=$(echo "$response" | jq -r '.issues[].fields.issuetype.name' | paste -sd, -) + + # Set the ISSUE_TYPES environment variable + echo "ISSUE_TYPES=$issue_types" >> $GITHUB_ENV + + # Optional: Print the result for debugging + echo "Found issue types: $issue_types" env: JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }} JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} + - name: Log created or updated issue run: | - if [ -n "${{ env.ISSUE_KEYS }}" ]; then - echo "Issue ${{ env.ISSUE_KEYS }} was created or updated" + if [ -n "${{ env.ISSUE_TYPES }}" ]; then + echo "Issue ${{ env.ISSUE_TYPES }} was created or updated" else echo "Failed to create or update issue" exit 1 @@ -78,13 +88,13 @@ jobs: issue_number: pr.number, owner: context.repo.owner, repo: context.repo.repo, - body: `${{ env.ISSUE_KEYS }} created or updated on Jira board` + body: `${{ env.ISSUE_TYPES }} created or updated on Jira board` }); }); - name: Transition issue uses: atlassian/gajira-transition@master with: - issue: ${{ env.issue_key }} + issue: ${{ env.ISSUE_TYPES }} transition: "Backlog" continue-on-error: true \ No newline at end of file From 1ceba702d87c16bbaac63609198167e8493e0076 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Sun, 26 Jan 2025 23:55:43 +0000 Subject: [PATCH 100/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 27 +-------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 03209b5..3154ca1 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -41,32 +41,7 @@ jobs: PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - - name: Search Jira tickets and set ISSUE_TYPES - run: | - # Run the Jira API call to fetch issues - response=$(curl --request POST \ - --url 'https://dsdmoj.atlassian.net/rest/api/3/search' \ - --user "$JIRA_USERNAME:$JIRA_API_TOKEN" \ - --header 'Accept: application/json' \ - --header 'Content-Type: application/json' \ - --data '{ - "jql": "project = ND AND labels = dependabot", - "fields": ["key", "issuetype"] - }') - - # Parse the issue types from the JSON response using jq - issue_types=$(echo "$response" | jq -r '.issues[].fields.issuetype.name' | paste -sd, -) - - # Set the ISSUE_TYPES environment variable - echo "ISSUE_TYPES=$issue_types" >> $GITHUB_ENV - - # Optional: Print the result for debugging - echo "Found issue types: $issue_types" - env: - JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }} - JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - - + - name: Log created or updated issue run: | From ce5578ee1e82d2c962300fa0c276c47d32f3a9ac Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 00:02:17 +0000 Subject: [PATCH 101/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 38 +++++++++++++++++---- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 3154ca1..ddc4e9f 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,15 +38,40 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a[...] echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - + - name: Find Jira tickets in project ND labeled Dependabot + env: + JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} + JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} + run: | + echo "Searching for issues with the 'dependabot' label in project 'ND'..." + + # Define JQL query to find issues with the 'dependabot' label in the 'ND' project + JQL_QUERY='project="ND" AND labels="Dependabot"' + + # Make API request to Jira to search for issues with the given label in the 'ND' project + response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X GET \ + -H "Content-Type: application/json" \ + "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") + + # Extract the first issue key from the response + issue_id=$(echo $response | jq -r '.issues[0].key') + + if [ -z "$issue_id" ]; then + echo "No issues found with the 'dependabot' label in project 'ND'." + else + echo "Found issue $issue_id" + echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV + fi - name: Log created or updated issue run: | - if [ -n "${{ env.ISSUE_TYPES }}" ]; then - echo "Issue ${{ env.ISSUE_TYPES }} was created or updated" + if [ -n "${{ env.ISSUE_ID }}" ]; then + echo "Issue ${{ env.ISSUE_ID }} was created or updated" else echo "Failed to create or update issue" exit 1 @@ -63,13 +88,14 @@ jobs: issue_number: pr.number, owner: context.repo.owner, repo: context.repo.repo, - body: `${{ env.ISSUE_TYPES }} created or updated on Jira board` + body: `${{ env.ISSUE_ID }} created or updated on Jira board` }); }); - name: Transition issue uses: atlassian/gajira-transition@master with: - issue: ${{ env.ISSUE_TYPES }} + issue: ${{ env.ISSUE_ID + }} transition: "Backlog" continue-on-error: true \ No newline at end of file From c0cd16a03603302ebd67d87ba57e366f39e7699f Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 00:03:31 +0000 Subject: [PATCH 102/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index ddc4e9f..a7a342a 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -95,7 +95,6 @@ jobs: - name: Transition issue uses: atlassian/gajira-transition@master with: - issue: ${{ env.ISSUE_ID - }} + issue: ${{ env.ISSUE_ID}} transition: "Backlog" continue-on-error: true \ No newline at end of file From 23081e36ebe5e4f747a8f49bd82cf2f649738c75 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 00:06:19 +0000 Subject: [PATCH 103/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index a7a342a..5c24838 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -38,7 +38,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a[...] + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Find Jira tickets in project ND labeled Dependabot From d6ad8650662ef3b070e4d1d2f17eeeadea16cc7d Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 00:10:49 +0000 Subject: [PATCH 104/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 25 ++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5c24838..df284d5 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -50,16 +50,31 @@ jobs: echo "Searching for issues with the 'dependabot' label in project 'ND'..." # Define JQL query to find issues with the 'dependabot' label in the 'ND' project - JQL_QUERY='project="ND" AND labels="Dependabot"' + JQL_QUERY="project=ND AND labels=Dependabot" + + # URL encode the JQL query to handle special characters + JQL_QUERY=$(echo "$JQL_QUERY" | jq -sRr @uri) # Make API request to Jira to search for issues with the given label in the 'ND' project - response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + response=$(curl -s -w "%{http_code}" -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") + "$JIRA_URL/rest/api/3/search?jql=$JQL_QUERY") + + # Extract HTTP status code + http_code=$(echo "$response" | tail -n 1) + + if [ "$http_code" -ne 200 ]; then + echo "Error: Received HTTP status code $http_code" + echo "Response: $(echo "$response" | head -n -1)" + exit 1 + fi + + # Print the raw response for debugging + echo "Response from Jira API: $(echo "$response" | head -n -1)" - # Extract the first issue key from the response - issue_id=$(echo $response | jq -r '.issues[0].key') + # Extract the first issue key from the response using jq + issue_id=$(echo "$response" | jq -r '.issues[0].key // empty') if [ -z "$issue_id" ]; then echo "No issues found with the 'dependabot' label in project 'ND'." From df922d0faf644474f999465b62fe416b5731994d Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 00:14:08 +0000 Subject: [PATCH 105/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index df284d5..595ad4f 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -50,7 +50,7 @@ jobs: echo "Searching for issues with the 'dependabot' label in project 'ND'..." # Define JQL query to find issues with the 'dependabot' label in the 'ND' project - JQL_QUERY="project=ND AND labels=Dependabot" + JQL_QUERY="project=ND AND labels=jira_dependabot" # URL encode the JQL query to handle special characters JQL_QUERY=$(echo "$JQL_QUERY" | jq -sRr @uri) From 44ecb8e84eeed960437101917c1ca449dc77efec Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 00:17:21 +0000 Subject: [PATCH 106/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 595ad4f..21a292b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -70,9 +70,6 @@ jobs: exit 1 fi - # Print the raw response for debugging - echo "Response from Jira API: $(echo "$response" | head -n -1)" - # Extract the first issue key from the response using jq issue_id=$(echo "$response" | jq -r '.issues[0].key // empty') From 80ab9dccf744be7c7b1f30f785c3bd5c313dcc62 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 00:19:29 +0000 Subject: [PATCH 107/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 21a292b..8ad2f44 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -71,7 +71,7 @@ jobs: fi # Extract the first issue key from the response using jq - issue_id=$(echo "$response" | jq -r '.issues[0].key // empty') + issue_id=$(echo "$response" | jq -r '.issues.key // empty') if [ -z "$issue_id" ]; then echo "No issues found with the 'dependabot' label in project 'ND'." From 12a963dacd5a7f4e3deaed9c8ec61814a4f92a3d Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 00:35:17 +0000 Subject: [PATCH 108/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 8ad2f44..21a292b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -71,7 +71,7 @@ jobs: fi # Extract the first issue key from the response using jq - issue_id=$(echo "$response" | jq -r '.issues.key // empty') + issue_id=$(echo "$response" | jq -r '.issues[0].key // empty') if [ -z "$issue_id" ]; then echo "No issues found with the 'dependabot' label in project 'ND'." From 778fb76b8bf98afad24726b68eff71d061b7e077 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 00:37:54 +0000 Subject: [PATCH 109/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 21a292b..27e4dd9 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -47,7 +47,7 @@ jobs: JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} run: | - echo "Searching for issues with the 'dependabot' label in project 'ND'..." + echo "Searching for issues with the 'jira_dependabot' label in project 'ND'..." # Define JQL query to find issues with the 'dependabot' label in the 'ND' project JQL_QUERY="project=ND AND labels=jira_dependabot" @@ -61,15 +61,6 @@ jobs: -H "Content-Type: application/json" \ "$JIRA_URL/rest/api/3/search?jql=$JQL_QUERY") - # Extract HTTP status code - http_code=$(echo "$response" | tail -n 1) - - if [ "$http_code" -ne 200 ]; then - echo "Error: Received HTTP status code $http_code" - echo "Response: $(echo "$response" | head -n -1)" - exit 1 - fi - # Extract the first issue key from the response using jq issue_id=$(echo "$response" | jq -r '.issues[0].key // empty') From 6e2f28420adc6443d58a9188a9d2ac54d18a80d5 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 00:40:21 +0000 Subject: [PATCH 110/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 51 +++++++++++---------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 27e4dd9..2cecf9d 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -48,37 +48,40 @@ jobs: JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} run: | echo "Searching for issues with the 'jira_dependabot' label in project 'ND'..." - + # Define JQL query to find issues with the 'dependabot' label in the 'ND' project - JQL_QUERY="project=ND AND labels=jira_dependabot" - - # URL encode the JQL query to handle special characters - JQL_QUERY=$(echo "$JQL_QUERY" | jq -sRr @uri) - + JQL_QUERY='project="ND" AND labels="jira_dependabot"' + # Make API request to Jira to search for issues with the given label in the 'ND' project - response=$(curl -s -w "%{http_code}" -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/3/search?jql=$JQL_QUERY") - - # Extract the first issue key from the response using jq - issue_id=$(echo "$response" | jq -r '.issues[0].key // empty') - - if [ -z "$issue_id" ]; then - echo "No issues found with the 'dependabot' label in project 'ND'." - else - echo "Found issue $issue_id" - echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV - fi - - - name: Log created or updated issue - run: | - if [ -n "${{ env.ISSUE_ID }}" ]; then - echo "Issue ${{ env.ISSUE_ID }} was created or updated" + "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") + + # Check if the response is valid JSON + if echo "$response" | jq -e . >/dev/null 2>&1; then + # Extract the first issue key from the response + issue_id=$(echo $response | jq -r '.issues[0].key') + + if [ -z "$issue_id" ]; then + echo "No issues found with the 'jira_dependabot' label in project 'ND'." + else + echo "Found issue $issue_id" + echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV + fi else - echo "Failed to create or update issue" + echo "Invalid JSON response" exit 1 fi + + - name: Log created or updated issue + run: | + if [ -n "${{ env.ISSUE_ID }}" ]; then + echo "Issue ${{ env.ISSUE_ID }} was created or updated" + else + echo "Failed to create or update issue" + exit 1 + fi - name: Comment on GitHub uses: actions/github-script@v7 From 018d383ca835bab2a58468f9adfe42809bd2af94 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 00:44:55 +0000 Subject: [PATCH 111/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 2cecf9d..82dd4b1 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -58,6 +58,8 @@ jobs: -H "Content-Type: application/json" \ "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") + echo "RESPONSE=$response" >> $GITHUB_ENV + # Check if the response is valid JSON if echo "$response" | jq -e . >/dev/null 2>&1; then # Extract the first issue key from the response From c5c11a46f9ff5097b48109c4f16286d0309e405f Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:09:59 +0000 Subject: [PATCH 112/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 82dd4b1..29e7f84 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -52,6 +52,10 @@ jobs: # Define JQL query to find issues with the 'dependabot' label in the 'ND' project JQL_QUERY='project="ND" AND labels="jira_dependabot"' + QUERY = "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY" + + echo "QUERY=$QUERY" >> $GITHUB_ENV + # Make API request to Jira to search for issues with the given label in the 'ND' project response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ From c65c1777fa6b357eeba632bdb2cfa2aaafba40a4 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:12:10 +0000 Subject: [PATCH 113/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 29e7f84..1a061b5 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -51,10 +51,8 @@ jobs: # Define JQL query to find issues with the 'dependabot' label in the 'ND' project JQL_QUERY='project="ND" AND labels="jira_dependabot"' - - QUERY = "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY" - - echo "QUERY=$QUERY" >> $GITHUB_ENV + + echo "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY" # Make API request to Jira to search for issues with the given label in the 'ND' project response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ From 53f219cf938adf3c5d8793b11e106bc52de1c2a9 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:21:56 +0000 Subject: [PATCH 114/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 1a061b5..f127ec6 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -51,16 +51,16 @@ jobs: # Define JQL query to find issues with the 'dependabot' label in the 'ND' project JQL_QUERY='project="ND" AND labels="jira_dependabot"' - - echo "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY" # Make API request to Jira to search for issues with the given label in the 'ND' project - response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ - -X GET \ + response=$(curl -D- \ + -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X POST \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") + --data '{"jql":"project = ND","fields":["id","key"]}' \ + "$JIRA_URL/rest/api/2/search") - echo "RESPONSE=$response" >> $GITHUB_ENV + echo $response # Check if the response is valid JSON if echo "$response" | jq -e . >/dev/null 2>&1; then From 9baa53572fa369c031e869c6d65b56672475fb43 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:25:35 +0000 Subject: [PATCH 115/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index f127ec6..8b74fc0 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -53,19 +53,19 @@ jobs: JQL_QUERY='project="ND" AND labels="jira_dependabot"' # Make API request to Jira to search for issues with the given label in the 'ND' project - response=$(curl -D- \ - -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data '{"jql":"project = ND","fields":["id","key"]}' \ + --data "{\"jql\":\"$JQL_QUERY\",\"fields\":[\"id\",\"key\"]}" \ "$JIRA_URL/rest/api/2/search") - echo $response + # Write the response to an environment variable + echo "JIRA_RESPONSE=$response" >> $GITHUB_ENV # Check if the response is valid JSON if echo "$response" | jq -e . >/dev/null 2>&1; then # Extract the first issue key from the response - issue_id=$(echo $response | jq -r '.issues[0].key') + issue_id=$(echo "$response" | jq -r '.issues[0].key') if [ -z "$issue_id" ]; then echo "No issues found with the 'jira_dependabot' label in project 'ND'." @@ -77,9 +77,9 @@ jobs: echo "Invalid JSON response" exit 1 fi - - - name: Log created or updated issue - run: | + + - name: Log created or updated issue + run: | if [ -n "${{ env.ISSUE_ID }}" ]; then echo "Issue ${{ env.ISSUE_ID }} was created or updated" else From 5a935c84ae8d46497bbe953d0ce14e7f9b1b1827 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:32:33 +0000 Subject: [PATCH 116/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 8b74fc0..daf0a13 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -50,13 +50,12 @@ jobs: echo "Searching for issues with the 'jira_dependabot' label in project 'ND'..." # Define JQL query to find issues with the 'dependabot' label in the 'ND' project - JQL_QUERY='project="ND" AND labels="jira_dependabot"' + JQL_QUERY='project = ND AND labels = jira_dependabot AND fields=id,key' # Make API request to Jira to search for issues with the given label in the 'ND' project response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ - -X POST \ + -X GET \ -H "Content-Type: application/json" \ - --data "{\"jql\":\"$JQL_QUERY\",\"fields\":[\"id\",\"key\"]}" \ "$JIRA_URL/rest/api/2/search") # Write the response to an environment variable From 17443eb8ad13cc2913c3ca162a25d9335f245e1b Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:37:34 +0000 Subject: [PATCH 117/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index daf0a13..e7ee04e 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -56,7 +56,7 @@ jobs: response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search") + "$JIRA_URL/rest/api/2/search/$JQL_QUERY") # Write the response to an environment variable echo "JIRA_RESPONSE=$response" >> $GITHUB_ENV From e5a8e4be3670fae145a417e7fe5c37d2a3bde5e3 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:38:29 +0000 Subject: [PATCH 118/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index e7ee04e..c30abef 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -50,7 +50,7 @@ jobs: echo "Searching for issues with the 'jira_dependabot' label in project 'ND'..." # Define JQL query to find issues with the 'dependabot' label in the 'ND' project - JQL_QUERY='project = ND AND labels = jira_dependabot AND fields=id,key' + JQL_QUERY='project = ND AND labels = jira_dependabot' # Make API request to Jira to search for issues with the given label in the 'ND' project response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ From cd409fab60cd116e6ce6736021e6d2e3815d8e68 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:39:13 +0000 Subject: [PATCH 119/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index c30abef..4e8758c 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -50,7 +50,7 @@ jobs: echo "Searching for issues with the 'jira_dependabot' label in project 'ND'..." # Define JQL query to find issues with the 'dependabot' label in the 'ND' project - JQL_QUERY='project = ND AND labels = jira_dependabot' + JQL_QUERY='labels = jira_dependabot' # Make API request to Jira to search for issues with the given label in the 'ND' project response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ From 8d3429ae8133af674647ebca745bc38161d7226e Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:43:31 +0000 Subject: [PATCH 120/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 4e8758c..5803cad 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -50,7 +50,7 @@ jobs: echo "Searching for issues with the 'jira_dependabot' label in project 'ND'..." # Define JQL query to find issues with the 'dependabot' label in the 'ND' project - JQL_QUERY='labels = jira_dependabot' + JQL_QUERY='project = ND AND labels in (JDTEST)' # Make API request to Jira to search for issues with the given label in the 'ND' project response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ From f2c585433760b7686d982b184ddb5645a38d169b Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:45:00 +0000 Subject: [PATCH 121/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5803cad..22d68d5 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -56,7 +56,7 @@ jobs: response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search/$JQL_QUERY") + "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") # Write the response to an environment variable echo "JIRA_RESPONSE=$response" >> $GITHUB_ENV From 8386606898e3394a7ced824b95903e3fc312cd82 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:48:13 +0000 Subject: [PATCH 122/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 22d68d5..61bc707 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -56,7 +56,7 @@ jobs: response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") + "$JIRA_URL/rest/api/2/search?jql=ND%20AND%20labels%3D%27JDTEST%27&fields=id,key") # Write the response to an environment variable echo "JIRA_RESPONSE=$response" >> $GITHUB_ENV From 022acb33af004380010edec2591fa19c1a8ff954 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:49:23 +0000 Subject: [PATCH 123/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 61bc707..5e8541d 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -56,7 +56,7 @@ jobs: response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=ND%20AND%20labels%3D%27JDTEST%27&fields=id,key") + "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27JDTEST%27&fields=id,key") # Write the response to an environment variable echo "JIRA_RESPONSE=$response" >> $GITHUB_ENV From c3dd9696b8c0938effc1a9d377b0c807324d2529 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:51:08 +0000 Subject: [PATCH 124/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5e8541d..0cbd5a4 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -56,7 +56,7 @@ jobs: response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27JDTEST%27&fields=id,key") + "$JIRA_URL/rest/api/2/search?jql=project=ND AND labels=JDTEST") # Write the response to an environment variable echo "JIRA_RESPONSE=$response" >> $GITHUB_ENV From e4b9f988e8c3d348e7548da554c15f2b1a5e0d6c Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:52:27 +0000 Subject: [PATCH 125/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 0cbd5a4..88632cf 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -56,7 +56,7 @@ jobs: response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=project=ND AND labels=JDTEST") + "$JIRA_URL/rest/api/2/search?jql=project=ND AND labels='JDTEST'") # Write the response to an environment variable echo "JIRA_RESPONSE=$response" >> $GITHUB_ENV From 0ab631c52007a17aec779983b1e84ae3a12371de Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:54:14 +0000 Subject: [PATCH 126/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 88632cf..7f9f214 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -56,10 +56,7 @@ jobs: response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=project=ND AND labels='JDTEST'") - - # Write the response to an environment variable - echo "JIRA_RESPONSE=$response" >> $GITHUB_ENV + "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27JDTEST%27") # Check if the response is valid JSON if echo "$response" | jq -e . >/dev/null 2>&1; then From db9ba15569b415984e476d4531f54b443dc5ae64 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:58:16 +0000 Subject: [PATCH 127/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 50 ++++++++++++--------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 7f9f214..3aa1405 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -16,13 +16,7 @@ jobs: runs-on: ubuntu-latest name: Create or Update 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: List open Dependabot PRs on main branch id: list-prs env: @@ -59,20 +53,36 @@ jobs: "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27JDTEST%27") # Check if the response is valid JSON - if echo "$response" | jq -e . >/dev/null 2>&1; then - # Extract the first issue key from the response - issue_id=$(echo "$response" | jq -r '.issues[0].key') + if echo "$response" | jq -e . >/dev/null 2>&1; then - if [ -z "$issue_id" ]; then - echo "No issues found with the 'jira_dependabot' label in project 'ND'." - else - echo "Found issue $issue_id" - echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV - fi - else - echo "Invalid JSON response" - exit 1 - fi + # Extract the first issue key from the response + issue_id=$(echo "$response" | jq -r '.issues[0].key') + + if [ -z "$issue_id" ]; then + echo "No issues found with the 'JDTEST' label in project 'ND'. Creating a new issue..." + create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X POST \ + -H "Content-Type: application/json" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"jira_dependabot\"]}}" \ + "$JIRA_URL/rest/api/2/issue") + new_issue_id=$(echo "$create_response" | jq -r '.key') + echo "Created new issue $new_issue_id" + echo "ISSUE_ID=$new_issue_id" >> $GITHUB_ENV + else + echo "Found issue $issue_id. Updating the description..." + update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X PUT \ + -H "Content-Type: application/json" \ + --data "{\"fields\":{\"description\":\"$PR_DESCRIPTION\"}}" \ + "$JIRA_URL/rest/api/2/issue/$issue_id") + echo "Updated issue $issue_id" + echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV + fi + else + echo "Invalid JSON response" + exit 1 + fi + - name: Log created or updated issue run: | From 70f24681d97f54f243c777b685922a96db4afd6a Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 01:59:06 +0000 Subject: [PATCH 128/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 3aa1405..7b2beb1 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest name: Create or Update Jira Ticket steps: - - + - name: List open Dependabot PRs on main branch id: list-prs env: From 558214078f132d7534469acf0672208f38ac6707 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 02:02:02 +0000 Subject: [PATCH 129/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 7b2beb1..7923cff 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -41,7 +41,7 @@ jobs: JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} run: | - echo "Searching for issues with the 'jira_dependabot' label in project 'ND'..." + echo "Searching for issues with the 'JDTEST' label in project 'ND'..." # Define JQL query to find issues with the 'dependabot' label in the 'ND' project JQL_QUERY='project = ND AND labels in (JDTEST)' From 5c42cabf4f41d118fb7add5542e7f20673e7ca80 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 02:09:13 +0000 Subject: [PATCH 130/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 55 ++++++++++----------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 7923cff..a090469 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -53,35 +53,34 @@ jobs: "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27JDTEST%27") # Check if the response is valid JSON - if echo "$response" | jq -e . >/dev/null 2>&1; then - - # Extract the first issue key from the response - issue_id=$(echo "$response" | jq -r '.issues[0].key') + if echo "$response" | jq -e . >/dev/null 2>&1; then + # Extract the first issue key from the response + issue_id=$(echo "$response" | jq -r '.issues[0].key') - if [ -z "$issue_id" ]; then - echo "No issues found with the 'JDTEST' label in project 'ND'. Creating a new issue..." - create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ - -X POST \ - -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"jira_dependabot\"]}}" \ - "$JIRA_URL/rest/api/2/issue") - new_issue_id=$(echo "$create_response" | jq -r '.key') - echo "Created new issue $new_issue_id" - echo "ISSUE_ID=$new_issue_id" >> $GITHUB_ENV - else - echo "Found issue $issue_id. Updating the description..." - update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ - -X PUT \ - -H "Content-Type: application/json" \ - --data "{\"fields\":{\"description\":\"$PR_DESCRIPTION\"}}" \ - "$JIRA_URL/rest/api/2/issue/$issue_id") - echo "Updated issue $issue_id" - echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV - fi - else - echo "Invalid JSON response" - exit 1 - fi + if [ -z "$issue_id" ]; then + echo "No issues found with the 'JDTEST' label in project 'ND'. Creating a new issue..." + create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X POST \ + -H "Content-Type: application/json" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"jira_dependabot\"]}}" \ + "$JIRA_URL/rest/api/2/issue") + new_issue_id=$(echo "$create_response" | jq -r '.key') + echo "Created new issue $new_issue_id" + echo "ISSUE_ID=$new_issue_id" >> $GITHUB_ENV + else + echo "Found issue $issue_id. Updating the description..." + update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X PUT \ + -H "Content-Type: application/json" \ + --data "{\"fields\":{\"description\":\"$PR_DESCRIPTION\"}}" \ + "$JIRA_URL/rest/api/2/issue/$issue_id") + echo "Updated issue $issue_id" + echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV + fi + else + echo "Invalid JSON response" + exit 1 + fi - name: Log created or updated issue From 88ae294da645756ecfc556fc503d36023161fd2f Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 02:11:36 +0000 Subject: [PATCH 131/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index a090469..76c740a 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -16,7 +16,6 @@ jobs: runs-on: ubuntu-latest name: Create or Update Jira Ticket steps: - - name: List open Dependabot PRs on main branch id: list-prs env: @@ -56,7 +55,7 @@ jobs: if echo "$response" | jq -e . >/dev/null 2>&1; then # Extract the first issue key from the response issue_id=$(echo "$response" | jq -r '.issues[0].key') - + if [ -z "$issue_id" ]; then echo "No issues found with the 'JDTEST' label in project 'ND'. Creating a new issue..." create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ @@ -82,15 +81,14 @@ jobs: exit 1 fi - - name: Log created or updated issue run: | - if [ -n "${{ env.ISSUE_ID }}" ]; then - echo "Issue ${{ env.ISSUE_ID }} was created or updated" - else - echo "Failed to create or update issue" - exit 1 - fi + if [ -n "${{ env.ISSUE_ID }}" ]; then + echo "Issue ${{ env.ISSUE_ID }} was created or updated" + else + echo "Failed to create or update issue" + exit 1 + fi - name: Comment on GitHub uses: actions/github-script@v7 From 72d7edb4bd13bc0f3732fb195118ad703cb09858 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 02:13:18 +0000 Subject: [PATCH 132/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 76c740a..d26d8c3 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -61,7 +61,7 @@ jobs: create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"jira_dependabot\"]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"Updated $PR_DESCRIPTION\",\"labels\":[\"JDTEST\"]}}" \ "$JIRA_URL/rest/api/2/issue") new_issue_id=$(echo "$create_response" | jq -r '.key') echo "Created new issue $new_issue_id" From 2e46df810cf9a8f3935e0116244b97193c374f64 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 02:15:54 +0000 Subject: [PATCH 133/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index d26d8c3..e535035 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -61,7 +61,7 @@ jobs: create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"Updated $PR_DESCRIPTION\",\"labels\":[\"JDTEST\"]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Updated Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"JDTEST\"]}}" \ "$JIRA_URL/rest/api/2/issue") new_issue_id=$(echo "$create_response" | jq -r '.key') echo "Created new issue $new_issue_id" From 32ebd1c517bb2c385e56abb84c910f85e718ee6c Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 02:23:45 +0000 Subject: [PATCH 134/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index e535035..6ae7673 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -61,7 +61,7 @@ jobs: create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Updated Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"JDTEST\"]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"JDTEST\"]}}" \ "$JIRA_URL/rest/api/2/issue") new_issue_id=$(echo "$create_response" | jq -r '.key') echo "Created new issue $new_issue_id" @@ -71,7 +71,7 @@ jobs: update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X PUT \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"description\":\"$PR_DESCRIPTION\"}}" \ + --data "{\"fields\":{\"description\":\"Updated $PR_DESCRIPTION\"}}" \ "$JIRA_URL/rest/api/2/issue/$issue_id") echo "Updated issue $issue_id" echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV From 2cd8bfee67d9ec57c1e82006ea0ca6b040faf0ab Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 02:26:10 +0000 Subject: [PATCH 135/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 6ae7673..b0698fd 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -71,7 +71,7 @@ jobs: update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X PUT \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"description\":\"Updated $PR_DESCRIPTION\"}}" \ + --data "{\"fields\":{\"description\":\"Updated\n $PR_DESCRIPTION\"}}" \ "$JIRA_URL/rest/api/2/issue/$issue_id") echo "Updated issue $issue_id" echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV From 3fa70a663d8ef6d9d763a56f5070ee0a93495269 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 02:28:19 +0000 Subject: [PATCH 136/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index b0698fd..07845ff 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -31,7 +31,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) Title: \(.title) Branch: \(.headRefName) URL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Find Jira tickets in project ND labeled Dependabot From a76870d58bf8797289bd8a5ef2347b72efe17c79 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 02:36:32 +0000 Subject: [PATCH 137/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 07845ff..4fb21d4 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -71,7 +71,7 @@ jobs: update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X PUT \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"description\":\"Updated\n $PR_DESCRIPTION\"}}" \ + --data "{\"fields\":{\"description\":\"Updated on $CURRENT_DATE \n $PR_DESCRIPTION\"}}" \ "$JIRA_URL/rest/api/2/issue/$issue_id") echo "Updated issue $issue_id" echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV From bde17c70126dabb89db7abc8e1ceda9cc0bf6485 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 02:39:22 +0000 Subject: [PATCH 138/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 4fb21d4..5b49662 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -40,6 +40,7 @@ jobs: JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} run: | + CURRENT_DATE=$(date '+%Y-%m-%d %H:%M:%S') echo "Searching for issues with the 'JDTEST' label in project 'ND'..." # Define JQL query to find issues with the 'dependabot' label in the 'ND' project From 3a8e11a16ce3585caef59a1fb220817750cd6252 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 02:44:00 +0000 Subject: [PATCH 139/172] ND-271 Updated the ticket to include the functionality of updating or creating tickets --- .github/workflows/dependabot-pr-to-jira.yml | 25 ++++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5b49662..5ada888 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -106,9 +106,22 @@ jobs: }); }); - - name: Transition issue - uses: atlassian/gajira-transition@master - with: - issue: ${{ env.ISSUE_ID}} - transition: "Backlog" - continue-on-error: true \ No newline at end of file + - name: Find transition ID for Backlog + env: + JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} + JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} + run: | + transition_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X GET \ + -H "Content-Type: application/json" \ + "$JIRA_URL/rest/api/2/issue/${{ env.ISSUE_ID }}/transitions") + + transition_id=$(echo "$transition_response" | jq -r '.transitions[] | select(.name=="Backlog") | .id') + + if [ -z "$transition_id" ]; then + echo "Failed to find transition ID for 'Backlog'" + exit 1 + fi + + echo "TRANSITION_ID=$transition_id" >> $GITHUB_ENV \ No newline at end of file From 7448128435fe8776814ee721b532bd2e5e85bcb4 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 06:44:45 +0000 Subject: [PATCH 140/172] ND-271 Updated the search to look for label Dependabot' --- .github/workflows/dependabot-pr-to-jira.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5ada888..f52698b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -41,16 +41,16 @@ jobs: JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} run: | CURRENT_DATE=$(date '+%Y-%m-%d %H:%M:%S') - echo "Searching for issues with the 'JDTEST' label in project 'ND'..." + echo "Searching for issues with the 'Dependabot' label in project 'ND'..." # Define JQL query to find issues with the 'dependabot' label in the 'ND' project - JQL_QUERY='project = ND AND labels in (JDTEST)' + JQL_QUERY='project = ND AND labels in (Dependabot)' # Make API request to Jira to search for issues with the given label in the 'ND' project response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27JDTEST%27") + "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27Dependabot%27") # Check if the response is valid JSON if echo "$response" | jq -e . >/dev/null 2>&1; then @@ -58,11 +58,11 @@ jobs: issue_id=$(echo "$response" | jq -r '.issues[0].key') if [ -z "$issue_id" ]; then - echo "No issues found with the 'JDTEST' label in project 'ND'. Creating a new issue..." + echo "No issues found with the 'Dependabot' label in project 'ND'. Creating a new issue..." create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"JDTEST\"]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"Dependabot\"]}}" \ "$JIRA_URL/rest/api/2/issue") new_issue_id=$(echo "$create_response" | jq -r '.key') echo "Created new issue $new_issue_id" From d956cb9bbcc7a789c7c428e7c58702d18dff3661 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 06:49:33 +0000 Subject: [PATCH 141/172] ND-271 Updated the list PR function to include only dependabot PR's --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index f52698b..5343a3e 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -21,7 +21,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName,author > pr_list.json + gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName,author --author dependabot > pr_list.json if ! jq -e . pr_list.json > /dev/null 2>&1; then echo "Invalid JSON output from gh pr list" cat pr_list.json From a754fcb5d9b9dac1e4f2db024649acbdd26e0f14 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 06:51:50 +0000 Subject: [PATCH 142/172] ND-271 Updated the list PR function to include only dependabot PR's --- .github/workflows/dependabot-pr-to-jira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5343a3e..a38b2d0 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -21,7 +21,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName,author --author dependabot > pr_list.json + gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName,author > pr_list.json if ! jq -e . pr_list.json > /dev/null 2>&1; then echo "Invalid JSON output from gh pr list" cat pr_list.json @@ -31,7 +31,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nAuthor: (.author) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Find Jira tickets in project ND labeled Dependabot From a5f8e1aa5669faca607a4e6493b7377654140dfa Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 06:55:33 +0000 Subject: [PATCH 143/172] ND-271 Updated the list PR function to include only dependabot PR's --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index a38b2d0..ca7bf95 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -31,7 +31,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nAuthor: (.author) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nAuthor: (.author.login) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Find Jira tickets in project ND labeled Dependabot From 98a5b3f2e038b9773625a2768e87ceff15f66f83 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 07:01:45 +0000 Subject: [PATCH 144/172] ND-271 Updated the list PR function to include only dependabot PR's --- .github/workflows/dependabot-pr-to-jira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index ca7bf95..2e3374f 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -21,7 +21,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName,author > pr_list.json + gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName -A app/dependabot --search "status:success review:none" > pr_list.json if ! jq -e . pr_list.json > /dev/null 2>&1; then echo "Invalid JSON output from gh pr list" cat pr_list.json @@ -31,7 +31,7 @@ jobs: - name: Format PRs for Jira ticket Description id: format-prs run: | - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nAuthor: (.author.login) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Find Jira tickets in project ND labeled Dependabot From c5265a19ecf5243be6d6ba685f9181c9d193be85 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 08:00:56 +0000 Subject: [PATCH 145/172] ND-271 debugging the issue id when no dependabot labelled ticket is found --- .github/workflows/dependabot-pr-to-jira.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 2e3374f..09ac6b4 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -56,6 +56,7 @@ jobs: if echo "$response" | jq -e . >/dev/null 2>&1; then # Extract the first issue key from the response issue_id=$(echo "$response" | jq -r '.issues[0].key') + echo " issue_id from response $issue_id" if [ -z "$issue_id" ]; then echo "No issues found with the 'Dependabot' label in project 'ND'. Creating a new issue..." From 05d729ece98122722a25aef441df43086901d725 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 08:13:36 +0000 Subject: [PATCH 146/172] ND-271 debugging the issue id when no dependabot labelled ticket is found --- .github/workflows/dependabot-pr-to-jira.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 09ac6b4..eae7583 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -35,6 +35,7 @@ jobs: echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - name: Find Jira tickets in project ND labeled Dependabot + id: find-jira-ticket env: JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} @@ -43,7 +44,7 @@ jobs: CURRENT_DATE=$(date '+%Y-%m-%d %H:%M:%S') echo "Searching for issues with the 'Dependabot' label in project 'ND'..." - # Define JQL query to find issues with the 'dependabot' label in the 'ND' project + # Define JQL query to find issues with the 'dependabot' label in the 'ND' project JQL_QUERY='project = ND AND labels in (Dependabot)' # Make API request to Jira to search for issues with the given label in the 'ND' project @@ -53,9 +54,10 @@ jobs: "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27Dependabot%27") # Check if the response is valid JSON + if echo "$response" | jq -e . >/dev/null 2>&1; then # Extract the first issue key from the response - issue_id=$(echo "$response" | jq -r '.issues[0].key') + issue_id=$(echo "$response" | jq -r '.issues[0].key // "null"') echo " issue_id from response $issue_id" if [ -z "$issue_id" ]; then @@ -84,6 +86,7 @@ jobs: fi - name: Log created or updated issue + id: log-issue-update run: | if [ -n "${{ env.ISSUE_ID }}" ]; then echo "Issue ${{ env.ISSUE_ID }} was created or updated" @@ -93,6 +96,7 @@ jobs: fi - name: Comment on GitHub + id: comment-prs uses: actions/github-script@v7 with: script: | @@ -108,6 +112,7 @@ jobs: }); - name: Find transition ID for Backlog + id: transition-issue env: JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} From 6f5782b51227439f55fb6a3c02eb2b0722c73b6b Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 08:16:19 +0000 Subject: [PATCH 147/172] ND-271 debugging the issue id when no dependabot labelled ticket is found --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index eae7583..0fdc332 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -44,7 +44,7 @@ jobs: CURRENT_DATE=$(date '+%Y-%m-%d %H:%M:%S') echo "Searching for issues with the 'Dependabot' label in project 'ND'..." - # Define JQL query to find issues with the 'dependabot' label in the 'ND' project + # Define JQL query to find issues with the 'dependabot' label in the 'ND' project JQL_QUERY='project = ND AND labels in (Dependabot)' # Make API request to Jira to search for issues with the given label in the 'ND' project From 596cf74d550789851e3c0a5023ce708c76332c7f Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 08:22:09 +0000 Subject: [PATCH 148/172] ND-271 debugging the issue id when no dependabot labelled ticket is found --- .github/workflows/dependabot-pr-to-jira.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 0fdc332..7c75b64 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -53,6 +53,12 @@ jobs: -H "Content-Type: application/json" \ "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27Dependabot%27") + issue_count=$(echo "$response" | jq '.issues | length') + echo "Number of issues found: $issue_count" + + echo "Jira response: $response" + + # Check if the response is valid JSON if echo "$response" | jq -e . >/dev/null 2>&1; then From 2df64d564584258ec70f2310166a38e499f6913d Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 08:28:28 +0000 Subject: [PATCH 149/172] ND-271 debugging the issue id when no dependabot labelled ticket is found --- .github/workflows/dependabot-pr-to-jira.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 7c75b64..5b0a933 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -56,9 +56,6 @@ jobs: issue_count=$(echo "$response" | jq '.issues | length') echo "Number of issues found: $issue_count" - echo "Jira response: $response" - - # Check if the response is valid JSON if echo "$response" | jq -e . >/dev/null 2>&1; then @@ -66,7 +63,7 @@ jobs: issue_id=$(echo "$response" | jq -r '.issues[0].key // "null"') echo " issue_id from response $issue_id" - if [ -z "$issue_id" ]; then + if [ "$issue_count" -eq 0 ]; then echo "No issues found with the 'Dependabot' label in project 'ND'. Creating a new issue..." create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ From a057ef961cbed24633cc20d0e1a2aac1078c5265 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 08:35:56 +0000 Subject: [PATCH 150/172] ND-271 debugging the issue id when no dependabot labelled ticket is found --- .github/workflows/dependabot-pr-to-jira.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5b0a933..88dfff7 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -61,8 +61,7 @@ jobs: if echo "$response" | jq -e . >/dev/null 2>&1; then # Extract the first issue key from the response issue_id=$(echo "$response" | jq -r '.issues[0].key // "null"') - echo " issue_id from response $issue_id" - + if [ "$issue_count" -eq 0 ]; then echo "No issues found with the 'Dependabot' label in project 'ND'. Creating a new issue..." create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ @@ -70,6 +69,9 @@ jobs: -H "Content-Type: application/json" \ --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"Dependabot\"]}}" \ "$JIRA_URL/rest/api/2/issue") + + echo "$create_response" + new_issue_id=$(echo "$create_response" | jq -r '.key') echo "Created new issue $new_issue_id" echo "ISSUE_ID=$new_issue_id" >> $GITHUB_ENV From 23f38b7c96fb56f163035a370da9a9b1a41196f5 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 08:38:59 +0000 Subject: [PATCH 151/172] ND-271 added issue type to new ticket created --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 88dfff7..0376e9e 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -67,7 +67,7 @@ jobs: create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"labels\":[\"Dependabot\"]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\issuetype\":{\"name"}:\"Story"\,\"labels\":[\"Dependabot\"]}}" \ "$JIRA_URL/rest/api/2/issue") echo "$create_response" From f19a2e310898d98a7bffcb8b3c62a62f0863146f Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 08:40:55 +0000 Subject: [PATCH 152/172] ND-271 corrected the json format for issue creation --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 0376e9e..cf3721c 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -67,7 +67,7 @@ jobs: create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\issuetype\":{\"name"}:\"Story"\,\"labels\":[\"Dependabot\"]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"issuetype\":{\"name\"}:\"Story\",\"labels\":[\"Dependabot\"]}}" \ "$JIRA_URL/rest/api/2/issue") echo "$create_response" From 5ee592f71453ea5badec17da5efd45df362dcdc8 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 08:43:40 +0000 Subject: [PATCH 153/172] ND-271 corrected the json format for issue creation --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index cf3721c..040d59b 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -67,7 +67,7 @@ jobs: create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"issuetype\":{\"name\"}:\"Story\",\"labels\":[\"Dependabot\"]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\"]}}" \ "$JIRA_URL/rest/api/2/issue") echo "$create_response" From e38f6735c56f6da6285794e4c4c5580333b17e11 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 08:57:35 +0000 Subject: [PATCH 154/172] ND-271 added comments --- .github/workflows/dependabot-pr-to-jira.yml | 49 ++++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 040d59b..8a25d0f 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -2,13 +2,13 @@ on: workflow_call: secrets: TECH_SERVICES_JIRA_URL: - description: 'jira URL passed from the caller workflow' + description: 'Jira URL passed from the caller workflow' required: true TECH_SERVICES_JIRA_EMAIL: - description: 'email address passed from the caller workflow' + description: 'Email address passed from the caller workflow' required: true TECH_SERVICES_JIRA_TOKEN: - description: 'A token passed from the caller workflow' + description: 'API token passed from the caller workflow' required: true jobs: @@ -16,24 +16,31 @@ jobs: runs-on: ubuntu-latest name: Create or Update Jira Ticket steps: + # Step 1: List open Dependabot PRs on the main branch - name: List open Dependabot PRs on main branch id: list-prs env: GH_TOKEN: ${{ github.token }} run: | + # Get a list of open PRs with the 'dependabot' label, and save them to a JSON file gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName -A app/dependabot --search "status:success review:none" > pr_list.json + + # Check if the output is valid JSON if ! jq -e . pr_list.json > /dev/null 2>&1; then echo "Invalid JSON output from gh pr list" cat pr_list.json exit 1 fi + # Step 2: Format the PRs for Jira ticket description - name: Format PRs for Jira ticket Description id: format-prs run: | + # Format PR details into a description suitable for a Jira issue PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV + # Step 3: Find Jira tickets in project ND labeled 'Dependabot' - name: Find Jira tickets in project ND labeled Dependabot id: find-jira-ticket env: @@ -44,7 +51,7 @@ jobs: CURRENT_DATE=$(date '+%Y-%m-%d %H:%M:%S') echo "Searching for issues with the 'Dependabot' label in project 'ND'..." - # Define JQL query to find issues with the 'dependabot' label in the 'ND' project + # Define JQL query to find issues with the 'Dependabot' label in the 'ND' project JQL_QUERY='project = ND AND labels in (Dependabot)' # Make API request to Jira to search for issues with the given label in the 'ND' project @@ -53,30 +60,38 @@ jobs: -H "Content-Type: application/json" \ "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27Dependabot%27") + # Count the number of issues returned by Jira issue_count=$(echo "$response" | jq '.issues | length') echo "Number of issues found: $issue_count" # Check if the response is valid JSON - if echo "$response" | jq -e . >/dev/null 2>&1; then - # Extract the first issue key from the response - issue_id=$(echo "$response" | jq -r '.issues[0].key // "null"') - + # Extract the issue key (ID) of the first issue from the response + issue_id=$(echo "$response" | jq -r '.issues[0].key // "null"') + + # If no issues are found, create a new issue if [ "$issue_count" -eq 0 ]; then echo "No issues found with the 'Dependabot' label in project 'ND'. Creating a new issue..." + + # Create a new Jira issue with the formatted PR description create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\"]}}" \ "$JIRA_URL/rest/api/2/issue") - + + # Output the full response for logging echo "$create_response" - + + # Extract the issue ID of the newly created issue new_issue_id=$(echo "$create_response" | jq -r '.key') echo "Created new issue $new_issue_id" echo "ISSUE_ID=$new_issue_id" >> $GITHUB_ENV else + # If an issue exists, update the description echo "Found issue $issue_id. Updating the description..." + + # Update the existing issue's description with new PR details update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X PUT \ -H "Content-Type: application/json" \ @@ -86,13 +101,16 @@ jobs: echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV fi else + # If the response is invalid JSON, exit with an error echo "Invalid JSON response" exit 1 fi + # Step 4: Log the issue created or updated - name: Log created or updated issue id: log-issue-update run: | + # Check if the ISSUE_ID environment variable is set if [ -n "${{ env.ISSUE_ID }}" ]; then echo "Issue ${{ env.ISSUE_ID }} was created or updated" else @@ -100,13 +118,17 @@ jobs: exit 1 fi + # Step 5: Comment on all related PRs on GitHub - name: Comment on GitHub id: comment-prs uses: actions/github-script@v7 with: script: | + # Read the list of PRs from the generated JSON file const fs = require('fs'); const prs = JSON.parse(fs.readFileSync('pr_list.json', 'utf8')); + + # Loop through all PRs and add a comment indicating the Jira issue update prs.forEach(pr => { github.rest.issues.createComment({ issue_number: pr.number, @@ -116,6 +138,7 @@ jobs: }); }); + # Step 6: Find transition ID for 'Backlog' in Jira - name: Find transition ID for Backlog id: transition-issue env: @@ -123,16 +146,20 @@ jobs: JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} run: | + # Get the available transitions for the Jira issue transition_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ "$JIRA_URL/rest/api/2/issue/${{ env.ISSUE_ID }}/transitions") + # Find the transition ID for 'Backlog' transition_id=$(echo "$transition_response" | jq -r '.transitions[] | select(.name=="Backlog") | .id') + # If the transition ID is not found, exit with an error if [ -z "$transition_id" ]; then echo "Failed to find transition ID for 'Backlog'" exit 1 fi - echo "TRANSITION_ID=$transition_id" >> $GITHUB_ENV \ No newline at end of file + # Output the transition ID for logging + echo "TRANSITION_ID=$transition_id" >> $GITHUB_ENV From 35e8d202fbec52470025abcaccdf1567365f3d1b Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 11:11:47 +0000 Subject: [PATCH 155/172] ND-271 added comments --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 8a25d0f..5e1bf1f 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -124,7 +124,7 @@ jobs: uses: actions/github-script@v7 with: script: | - # Read the list of PRs from the generated JSON file + # Read the list of PRs from the generated JSON file const fs = require('fs'); const prs = JSON.parse(fs.readFileSync('pr_list.json', 'utf8')); From d7fd3b584ff391cbab7f057125b6c44609f8753c Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 11:13:51 +0000 Subject: [PATCH 156/172] ND-271 added comments --- .github/workflows/dependabot-pr-to-jira.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 5e1bf1f..45bce3c 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -124,11 +124,9 @@ jobs: uses: actions/github-script@v7 with: script: | - # Read the list of PRs from the generated JSON file const fs = require('fs'); const prs = JSON.parse(fs.readFileSync('pr_list.json', 'utf8')); - # Loop through all PRs and add a comment indicating the Jira issue update prs.forEach(pr => { github.rest.issues.createComment({ issue_number: pr.number, From 2403bbe3e24a96ad716562911a20093386bd7bc4 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 14:44:04 +0000 Subject: [PATCH 157/172] ND-271 the find jira ticket step has been split into find, create and update for better code maintainance --- .github/workflows/dependabot-pr-to-jira.yml | 111 +++++++++----------- 1 file changed, 50 insertions(+), 61 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 45bce3c..e285650 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -16,13 +16,13 @@ jobs: runs-on: ubuntu-latest name: Create or Update Jira Ticket steps: - # Step 1: List open Dependabot PRs on the main branch + # Step: List open Dependabot PRs on the main branch - name: List open Dependabot PRs on main branch id: list-prs env: GH_TOKEN: ${{ github.token }} run: | - # Get a list of open PRs with the 'dependabot' label, and save them to a JSON file + # Get a list of open PRs created by 'dependabot' and save them to a JSON file gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName -A app/dependabot --search "status:success review:none" > pr_list.json # Check if the output is valid JSON @@ -32,15 +32,15 @@ jobs: exit 1 fi - # Step 2: Format the PRs for Jira ticket description + # Step: Format the PRs for Jira ticket description - name: Format PRs for Jira ticket Description id: format-prs run: | # Format PR details into a description suitable for a Jira issue - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | se[...] echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - # Step 3: Find Jira tickets in project ND labeled 'Dependabot' + # Step: Find Jira tickets in project ND labeled 'Dependabot' - name: Find Jira tickets in project ND labeled Dependabot id: find-jira-ticket env: @@ -48,69 +48,65 @@ jobs: JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} run: | - CURRENT_DATE=$(date '+%Y-%m-%d %H:%M:%S') echo "Searching for issues with the 'Dependabot' label in project 'ND'..." - - # Define JQL query to find issues with the 'Dependabot' label in the 'ND' project JQL_QUERY='project = ND AND labels in (Dependabot)' - - # Make API request to Jira to search for issues with the given label in the 'ND' project response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27Dependabot%27") - - # Count the number of issues returned by Jira + "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") + echo "$response" > jira_search_response.json issue_count=$(echo "$response" | jq '.issues | length') echo "Number of issues found: $issue_count" - - # Check if the response is valid JSON if echo "$response" | jq -e . >/dev/null 2>&1; then - # Extract the issue key (ID) of the first issue from the response issue_id=$(echo "$response" | jq -r '.issues[0].key // "null"') - - # If no issues are found, create a new issue - if [ "$issue_count" -eq 0 ]; then - echo "No issues found with the 'Dependabot' label in project 'ND'. Creating a new issue..." - - # Create a new Jira issue with the formatted PR description - create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ - -X POST \ - -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\"]}}" \ - "$JIRA_URL/rest/api/2/issue") - - # Output the full response for logging - echo "$create_response" - - # Extract the issue ID of the newly created issue - new_issue_id=$(echo "$create_response" | jq -r '.key') - echo "Created new issue $new_issue_id" - echo "ISSUE_ID=$new_issue_id" >> $GITHUB_ENV - else - # If an issue exists, update the description - echo "Found issue $issue_id. Updating the description..." - - # Update the existing issue's description with new PR details - update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ - -X PUT \ - -H "Content-Type: application/json" \ - --data "{\"fields\":{\"description\":\"Updated on $CURRENT_DATE \n $PR_DESCRIPTION\"}}" \ - "$JIRA_URL/rest/api/2/issue/$issue_id") - echo "Updated issue $issue_id" - echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV - fi + echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV else - # If the response is invalid JSON, exit with an error echo "Invalid JSON response" exit 1 fi - # Step 4: Log the issue created or updated + # Step: Create Jira ticket if none found + - name: Create Jira ticket + if: env.ISSUE_ID == 'null' + id: create-jira-ticket + env: + JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} + JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} + run: | + echo "No issues found with the 'Dependabot' label in project 'ND'. Creating a new issue..." + create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X POST \ + -H "Content-Type: application/json" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\"]}}" \ + "$JIRA_URL/rest/api/2/issue") + echo "$create_response" + new_issue_id=$(echo "$create_response" | jq -r '.key') + echo "Created new issue $new_issue_id" + echo "ISSUE_ID=$new_issue_id" >> $GITHUB_ENV + + # Step: Update Jira ticket if found + - name: Update Jira ticket + if: env.ISSUE_ID != 'null' + id: update-jira-ticket + env: + JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} + JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} + JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} + run: | + CURRENT_DATE=$(date '+%Y-%m-%d %H:%M:%S') + echo "Found issue ${{ env.ISSUE_ID }}. Updating the description..." + update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ + -X PUT \ + -H "Content-Type: application/json" \ + --data "{\"fields\":{\"description\":\"Updated on $CURRENT_DATE \n $PR_DESCRIPTION\"}}" \ + "$JIRA_URL/rest/api/2/issue/${{ env.ISSUE_ID }}") + echo "Updated issue ${{ env.ISSUE_ID }}" + + # Step: Log the issue created or updated - name: Log created or updated issue id: log-issue-update run: | - # Check if the ISSUE_ID environment variable is set if [ -n "${{ env.ISSUE_ID }}" ]; then echo "Issue ${{ env.ISSUE_ID }} was created or updated" else @@ -118,7 +114,7 @@ jobs: exit 1 fi - # Step 5: Comment on all related PRs on GitHub + # Step: Comment on all related PRs on GitHub - name: Comment on GitHub id: comment-prs uses: actions/github-script@v7 @@ -136,7 +132,7 @@ jobs: }); }); - # Step 6: Find transition ID for 'Backlog' in Jira + # Step: Find transition ID for 'Backlog' in Jira - name: Find transition ID for Backlog id: transition-issue env: @@ -144,20 +140,13 @@ jobs: JIRA_API_TOKEN: ${{ secrets.TECH_SERVICES_JIRA_TOKEN }} JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} run: | - # Get the available transitions for the Jira issue transition_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ "$JIRA_URL/rest/api/2/issue/${{ env.ISSUE_ID }}/transitions") - - # Find the transition ID for 'Backlog' transition_id=$(echo "$transition_response" | jq -r '.transitions[] | select(.name=="Backlog") | .id') - - # If the transition ID is not found, exit with an error if [ -z "$transition_id" ]; then echo "Failed to find transition ID for 'Backlog'" exit 1 fi - - # Output the transition ID for logging - echo "TRANSITION_ID=$transition_id" >> $GITHUB_ENV + echo "TRANSITION_ID=$transition_id" >> $GITHUB_ENV \ No newline at end of file From da4858e26c6ee68953475430e061f9bab643d054 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 14:48:33 +0000 Subject: [PATCH 158/172] ND-271 corrected the errors --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index e285650..37fcffe 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -37,7 +37,7 @@ jobs: id: format-prs run: | # Format PR details into a description suitable for a Jira issue - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | se[...] + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed 's/$/\\n/') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV # Step: Find Jira tickets in project ND labeled 'Dependabot' From c4ab25599a5b9ba24b2952721e6e943347031175 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 14:56:10 +0000 Subject: [PATCH 159/172] ND-271 corrected the errors --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 37fcffe..7b05fec 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -37,7 +37,7 @@ jobs: id: format-prs run: | # Format PR details into a description suitable for a Jira issue - PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed 's/$/\\n/') + PR_DESCRIPTION=$(jq -r '.[] | "- PR Number: \(.number) \nTitle: \(.title) \nBranch: \(.headRefName) \nURL: https://github.com/${{ github.repository }}/pull/\(.number)\n"' pr_list.json | sed ':a;N;$!ba;s/\n/\\n/g') echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV # Step: Find Jira tickets in project ND labeled 'Dependabot' From 883ca75091d8f00b76cbfc1dbffba07247308070 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 14:58:29 +0000 Subject: [PATCH 160/172] ND-271 corrected the errors --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 7b05fec..bfa36e6 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -53,7 +53,7 @@ jobs: response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X GET \ -H "Content-Type: application/json" \ - "$JIRA_URL/rest/api/2/search?jql=$JQL_QUERY") + "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27Dependabot%27") echo "$response" > jira_search_response.json issue_count=$(echo "$response" | jq '.issues | length') echo "Number of issues found: $issue_count" From 82d636cc33ebc1a5f9cb2c3931628a57288aa0c2 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 15:01:14 +0000 Subject: [PATCH 161/172] ND-271 corrected the errors --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index bfa36e6..d1e732f 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -78,7 +78,7 @@ jobs: create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs\",\"description\":\"$PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\"]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ github.repository }}\",\"description\":\"$PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\"]}}" \ "$JIRA_URL/rest/api/2/issue") echo "$create_response" new_issue_id=$(echo "$create_response" | jq -r '.key') From 77c6634541aeb5a0537f54d0b3f5597e90a55eed Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 15:06:06 +0000 Subject: [PATCH 162/172] ND-271 added repo name as label --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index d1e732f..4e3c7ff 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -78,7 +78,7 @@ jobs: create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ github.repository }}\",\"description\":\"$PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\"]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ github.repository }}\",\"description\":\"Repository : ${{ github.repository }} \n $PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\",\"${{ github.repository }}\"]}}" \ "$JIRA_URL/rest/api/2/issue") echo "$create_response" new_issue_id=$(echo "$create_response" | jq -r '.key') From a4d9d8ed724e77e639154a6a338c6ac2186d6dad Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 15:08:45 +0000 Subject: [PATCH 163/172] ND-271 added repo name as label --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 4e3c7ff..739a8f5 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -99,7 +99,7 @@ jobs: update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X PUT \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"description\":\"Updated on $CURRENT_DATE \n $PR_DESCRIPTION\"}}" \ + --data "{\"fields\":{\"description\":\"Updated on $CURRENT_DATE \n Repository : ${{ github.repository }} \n $PR_DESCRIPTION\"}}" \ "$JIRA_URL/rest/api/2/issue/${{ env.ISSUE_ID }}") echo "Updated issue ${{ env.ISSUE_ID }}" From 38cc015b8addaa579d2cd58181a2a5fb86723c71 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 15:18:28 +0000 Subject: [PATCH 164/172] ND-271 added repo name as label --- .github/workflows/dependabot-pr-to-jira.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 739a8f5..b892973 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -54,9 +54,13 @@ jobs: -X GET \ -H "Content-Type: application/json" \ "$JIRA_URL/rest/api/2/search?jql=project=ND%20AND%20labels%3D%27Dependabot%27") + echo "$response" > jira_search_response.json + issue_count=$(echo "$response" | jq '.issues | length') echo "Number of issues found: $issue_count" + echo "ISSUE_COUNT=$issue_count" >> $GITHUB_ENV + if echo "$response" | jq -e . >/dev/null 2>&1; then issue_id=$(echo "$response" | jq -r '.issues[0].key // "null"') echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV @@ -67,7 +71,7 @@ jobs: # Step: Create Jira ticket if none found - name: Create Jira ticket - if: env.ISSUE_ID == 'null' + if: (env.ISSUE_COUNT == 0) id: create-jira-ticket env: JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} @@ -78,7 +82,7 @@ jobs: create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ github.repository }}\",\"description\":\"Repository : ${{ github.repository }} \n $PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\",\"${{ github.repository }}\"]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ github.repository }}\",\"description\":\"Repository : ${{ github.repository }} \n $PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\",\"$(echo ${{ github.repository }} | cut -d'/' -f2)\"]}}" \ "$JIRA_URL/rest/api/2/issue") echo "$create_response" new_issue_id=$(echo "$create_response" | jq -r '.key') @@ -87,7 +91,7 @@ jobs: # Step: Update Jira ticket if found - name: Update Jira ticket - if: env.ISSUE_ID != 'null' + if: (env.ISSUE_COUNT > 0) id: update-jira-ticket env: JIRA_URL: ${{ secrets.TECH_SERVICES_JIRA_URL }} From efb1615f4865bd836ddf26f780c87d7ec800a3a5 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 15:50:06 +0000 Subject: [PATCH 165/172] ND-271 added repo name as env variable --- .github/workflows/dependabot-pr-to-jira.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index b892973..10b5aa7 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -16,6 +16,12 @@ jobs: runs-on: ubuntu-latest name: Create or Update Jira Ticket steps: + + # Step: Set repo name + - name: Set repository name + id: set-repo-name + run: echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV + # Step: List open Dependabot PRs on the main branch - name: List open Dependabot PRs on main branch id: list-prs @@ -82,7 +88,7 @@ jobs: create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ github.repository }}\",\"description\":\"Repository : ${{ github.repository }} \n $PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\",\"$(echo ${{ github.repository }} | cut -d'/' -f2)\"]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ env.REPO_NAME }}\",\"description\":\"Repository : ${{ env.REPO_NAME}} \n $PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\",\"${{ env.REPO_NAME }}"\]}}" \ "$JIRA_URL/rest/api/2/issue") echo "$create_response" new_issue_id=$(echo "$create_response" | jq -r '.key') @@ -103,7 +109,7 @@ jobs: update_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X PUT \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"description\":\"Updated on $CURRENT_DATE \n Repository : ${{ github.repository }} \n $PR_DESCRIPTION\"}}" \ + --data "{\"fields\":{\"description\":\"Updated on $CURRENT_DATE \n Repository : ${{ env.REPO_NAME }} \n $PR_DESCRIPTION\"}}" \ "$JIRA_URL/rest/api/2/issue/${{ env.ISSUE_ID }}") echo "Updated issue ${{ env.ISSUE_ID }}" From 6055e25920057c47d5f91a0e6a679f501a179248 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 15:54:04 +0000 Subject: [PATCH 166/172] ND-271 added repo name as env variable --- .github/workflows/dependabot-pr-to-jira.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 10b5aa7..aa11391 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -85,12 +85,15 @@ jobs: JIRA_USERNAME: ${{ secrets.TECH_SERVICES_JIRA_EMAIL }} run: | echo "No issues found with the 'Dependabot' label in project 'ND'. Creating a new issue..." + create_response=$(curl -s -u $JIRA_USERNAME:$JIRA_API_TOKEN \ -X POST \ -H "Content-Type: application/json" \ - --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ env.REPO_NAME }}\",\"description\":\"Repository : ${{ env.REPO_NAME}} \n $PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\",\"${{ env.REPO_NAME }}"\]}}" \ + --data "{\"fields\":{\"project\":{\"key\":\"ND\"},\"summary\":\"Dependabot PRs for ${{ env.REPO_NAME }}\",\"description\":\"Repository : ${{ env.REPO_NAME }} \\n $PR_DESCRIPTION\",\"issuetype\":{\"name\":\"Story\"},\"labels\":[\"Dependabot\",\"${{ env.REPO_NAME }}\"]}}" \ "$JIRA_URL/rest/api/2/issue") - echo "$create_response" + + echo "$create_response" + new_issue_id=$(echo "$create_response" | jq -r '.key') echo "Created new issue $new_issue_id" echo "ISSUE_ID=$new_issue_id" >> $GITHUB_ENV From fd3dde04883e9865e686d616354b7707a8ff65b1 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 16:09:12 +0000 Subject: [PATCH 167/172] ND-271 added repo name as env variable --- .github/workflows/dependabot-pr-to-jira.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index aa11391..528b00c 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -28,10 +28,10 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - # Get a list of open PRs created by 'dependabot' and save them to a JSON file - gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName -A app/dependabot --search "status:success review:none" > pr_list.json - - # Check if the output is valid JSON + # Get a list of open PRs created by 'app/dependabot' or 'dependabot[bot]' and save them to a JSON file + gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName --search "author:app/dependabot author:dependabot[bot] status:success review:none" > pr_list.json + + # Check if the output is valid JSON if ! jq -e . pr_list.json > /dev/null 2>&1; then echo "Invalid JSON output from gh pr list" cat pr_list.json From 706f05a1ff2150955d8fd556a0956cad01fcf498 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 16:10:46 +0000 Subject: [PATCH 168/172] ND-271 added repo name as env variable --- .github/workflows/dependabot-pr-to-jira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index 528b00c..af0b81d 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -28,10 +28,10 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - # Get a list of open PRs created by 'app/dependabot' or 'dependabot[bot]' and save them to a JSON file + # Get a list of open PRs created by 'app/dependabot' or 'dependabot[bot]' and save them to a JSON file gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName --search "author:app/dependabot author:dependabot[bot] status:success review:none" > pr_list.json - # Check if the output is valid JSON + # Check if the output is valid JSON if ! jq -e . pr_list.json > /dev/null 2>&1; then echo "Invalid JSON output from gh pr list" cat pr_list.json From e54f1ef55399760ab30431442b13bcd3dc67682b Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Mon, 27 Jan 2025 16:55:36 +0000 Subject: [PATCH 169/172] ND-271 updated the search criteria --- .github/workflows/dependabot-pr-to-jira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-pr-to-jira.yml b/.github/workflows/dependabot-pr-to-jira.yml index af0b81d..3a08f82 100644 --- a/.github/workflows/dependabot-pr-to-jira.yml +++ b/.github/workflows/dependabot-pr-to-jira.yml @@ -29,7 +29,7 @@ jobs: GH_TOKEN: ${{ github.token }} run: | # Get a list of open PRs created by 'app/dependabot' or 'dependabot[bot]' and save them to a JSON file - gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName --search "author:app/dependabot author:dependabot[bot] status:success review:none" > pr_list.json + gh pr list --repo ${{ github.repository }} --base main --json number,title,headRefName --search "author:app/dependabot author:dependabot[bot]" > pr_list.json # Check if the output is valid JSON if ! jq -e . pr_list.json > /dev/null 2>&1; then From f6c3e698a928a896d65d4ece814573ba015c5a61 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Tue, 28 Jan 2025 08:02:36 +0000 Subject: [PATCH 170/172] ND-271 updated the schedule to run monday 4 pm every week --- .../dependabot-pr-to-jira-trigger.yml | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 1ca71ce..76ee9cd 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -1,14 +1,33 @@ -name: Add Issue to Jira Board On new Dependabot PR's +#name: Add Issue to Jira Board with details of Dependabot PR's +# +#on: +# push: +# branches: +# - ND-271-spike-dependabot-ticket-auto-creation-in-jira +# +#jobs: +# call-workflow-dependabot-pr-to-jira: +# if: github.ref == 'refs/heads/ND-271-spike-dependabot-ticket-auto-creation-in-jira' +# uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira +# 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 }} + + +name: Add Issue to Jira Board with details of Dependabot PR's on: + schedule: + - cron: '0 16 * * 1' # Runs every Monday at 4 PM UTC push: branches: - - ND-271-spike-dependabot-ticket-auto-creation-in-jira + - main jobs: call-workflow-dependabot-pr-to-jira: - if: github.ref == 'refs/heads/ND-271-spike-dependabot-ticket-auto-creation-in-jira' - uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira + if: github.ref == 'refs/heads/main' + 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 }} From ca33304ed9576a4431d1337dfafc90bc785c778c Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Tue, 28 Jan 2025 09:02:47 +0000 Subject: [PATCH 171/172] ND-271 removed the trigger to run every time code pushed to main --- .github/workflows/dependabot-pr-to-jira-trigger.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 76ee9cd..91de896 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -20,9 +20,6 @@ name: Add Issue to Jira Board with details of Dependabot PR's on: schedule: - cron: '0 16 * * 1' # Runs every Monday at 4 PM UTC - push: - branches: - - main jobs: call-workflow-dependabot-pr-to-jira: From fa2f8be2a0f9c7d76af89de10eb64fb44f2ad281 Mon Sep 17 00:00:00 2001 From: Sandhya Buddharaju Date: Tue, 28 Jan 2025 09:05:21 +0000 Subject: [PATCH 172/172] ND-271 removed the trigger to run every time code pushed to main --- .../workflows/dependabot-pr-to-jira-trigger.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/dependabot-pr-to-jira-trigger.yml b/.github/workflows/dependabot-pr-to-jira-trigger.yml index 91de896..bb59d81 100644 --- a/.github/workflows/dependabot-pr-to-jira-trigger.yml +++ b/.github/workflows/dependabot-pr-to-jira-trigger.yml @@ -1,20 +1,3 @@ -#name: Add Issue to Jira Board with details of Dependabot PR's -# -#on: -# push: -# branches: -# - ND-271-spike-dependabot-ticket-auto-creation-in-jira -# -#jobs: -# call-workflow-dependabot-pr-to-jira: -# if: github.ref == 'refs/heads/ND-271-spike-dependabot-ticket-auto-creation-in-jira' -# uses: ministryofjustice/nvvs-devops-github-actions/.github/workflows/dependabot-pr-to-jira.yml@ND-271-spike-dependabot-ticket-auto-creation-in-jira -# 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 }} - - name: Add Issue to Jira Board with details of Dependabot PR's on: