From c6a8a7452123ff796dc891881baa8de097c04814 Mon Sep 17 00:00:00 2001 From: asafdl Date: Thu, 7 May 2026 11:52:37 +0300 Subject: [PATCH] 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 000000000..4a1040cfd --- /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'); + }