From c6a8a7452123ff796dc891881baa8de097c04814 Mon Sep 17 00:00:00 2001 From: asafdl Date: Thu, 7 May 2026 11:52:37 +0300 Subject: [PATCH 1/2] feat: add jira-check --- .github/workflows/pr-jira-ticket.yml | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/pr-jira-ticket.yml diff --git a/.github/workflows/pr-jira-ticket.yml b/.github/workflows/pr-jira-ticket.yml new file mode 100644 index 0000000000..4a1040cfd4 --- /dev/null +++ b/.github/workflows/pr-jira-ticket.yml @@ -0,0 +1,36 @@ +name: PR Jira Ticket Check + +on: + workflow_call: + +# This allows a subsequently queued workflow run to interrupt previous runs +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + jira-ticket-check: + name: PR Jira Ticket + runs-on: ubuntu-latest + if: startsWith( github.repository, 'elementor/' ) + steps: + - name: Check for Jira ticket + uses: actions/github-script@v7 + with: + script: | + const pattern = /[A-Z]{2,10}-\d+/; + + const title = context.payload.pull_request?.title || ''; + const branch = context.payload.pull_request?.head?.ref || ''; + const body = context.payload.pull_request?.body || ''; + + const sources = { title, branch, body }; + const found = Object.entries(sources).find(([, value]) => pattern.test(value)); + + if (found) { + const [source, value] = found; + const ticket = value.match(pattern)[0]; + core.info(`Found Jira ticket ${ticket} in PR ${source}`); + } else { + core.setFailed('No Jira ticket found in PR title, branch name, or body'); + } From d5f60fa897d5df243c0d6075394dcfacf5a0ec14 Mon Sep 17 00:00:00 2001 From: asafdl Date: Thu, 7 May 2026 17:33:17 +0300 Subject: [PATCH 2/2] chore: change to action --- .github/workflows/pr-jira-ticket.yml | 36 ---------------------------- actions/pr-jira-ticket/action.yml | 26 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/pr-jira-ticket.yml create mode 100644 actions/pr-jira-ticket/action.yml diff --git a/.github/workflows/pr-jira-ticket.yml b/.github/workflows/pr-jira-ticket.yml deleted file mode 100644 index 4a1040cfd4..0000000000 --- a/.github/workflows/pr-jira-ticket.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: PR Jira Ticket Check - -on: - workflow_call: - -# This allows a subsequently queued workflow run to interrupt previous runs -concurrency: - group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' - cancel-in-progress: true - -jobs: - jira-ticket-check: - name: PR Jira Ticket - runs-on: ubuntu-latest - if: startsWith( github.repository, 'elementor/' ) - steps: - - name: Check for Jira ticket - uses: actions/github-script@v7 - with: - script: | - const pattern = /[A-Z]{2,10}-\d+/; - - const title = context.payload.pull_request?.title || ''; - const branch = context.payload.pull_request?.head?.ref || ''; - const body = context.payload.pull_request?.body || ''; - - const sources = { title, branch, body }; - const found = Object.entries(sources).find(([, value]) => pattern.test(value)); - - if (found) { - const [source, value] = found; - const ticket = value.match(pattern)[0]; - core.info(`Found Jira ticket ${ticket} in PR ${source}`); - } else { - core.setFailed('No Jira ticket found in PR title, branch name, or body'); - } diff --git a/actions/pr-jira-ticket/action.yml b/actions/pr-jira-ticket/action.yml new file mode 100644 index 0000000000..0871a066e6 --- /dev/null +++ b/actions/pr-jira-ticket/action.yml @@ -0,0 +1,26 @@ +name: PR Jira Ticket Check +description: Validates that a Jira ticket (e.g. ED-1234) exists in the PR title, branch name, or body. + +runs: + using: composite + steps: + - name: Check for Jira ticket + uses: actions/github-script@v7 + with: + script: | + const pattern = /[A-Z]{2,10}-\d+/; + + const title = context.payload.pull_request?.title || ''; + const branch = context.payload.pull_request?.head?.ref || ''; + const body = context.payload.pull_request?.body || ''; + + const sources = { title, branch, body }; + const found = Object.entries(sources).find(([, value]) => pattern.test(value)); + + if (found) { + const [source, value] = found; + const ticket = value.match(pattern)[0]; + core.info(`Found Jira ticket ${ticket} in PR ${source}`); + } else { + core.setFailed('No Jira ticket found in PR title, branch name, or body'); + }