diff --git a/.github/workflows/jira-pr-title.yml b/.github/workflows/jira-pr-title.yml deleted file mode 100644 index b6b6d67..0000000 --- a/.github/workflows/jira-pr-title.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: "Jira PR Title Check" -on: - pull_request: - types: [opened, reopened, synchronize] - workflow_dispatch: - inputs: - owner: - description: "Owner of the repository" - required: true - default: "peakon" - repo: - description: "Name of the repository" - required: true - default: ".github" - pull_number: - description: "Pull request number" - required: true - default: "1" - runner: - description: "Runner to use" - required: true - type: choice - options: - - "arc-runner-set" - - "ubuntu-latest" - - "windows-latest" - - "macos-latest" - default: "arc-runner-set" -jobs: - check-title: - runs-on: ${{ github.event.inputs && github.event.inputs.runner || 'arc-runner-set' }} - steps: - - name: Check PR title - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - retries: 3 - script: | - let data; - const owner = context.payload.inputs?.owner || context.repo.owner; - const repo = context.payload.inputs?.repo || context.repo.repo; - const pull_number = context.payload.inputs?.pull_number || context.issue.number; - - - try { - const result = await github.rest.pulls.get({ owner, repo, pull_number }); - - data = result.data; - } catch (error) { - const ip = await github.request('https://icanhazip.com'); - console.log('IP Address: ', ip); - - throw error; - } - - const prTitle = data.title; - - const jiraPattern = /[A-Z]+-\d+/g; - - - if (prTitle.includes('[Snyk]')) { - console.log('PR title contains [Snyk]'); - console.log('1. Labeling PR with `dependencies` and `security`'); - const issue_number = data.number; - const labels = ['dependencies', 'security']; - await github.rest.issues.addLabels({owner, repo, issue_number, labels}); - if (!jiraPattern.test(prTitle)) { - console.log('2. Adding `[PEAKON-2516]` prefix to PR title'); - const title = `[PEAKON-2516] ${prTitle}`; - await github.rest.pulls.update({owner, repo, pull_number, title}); - } - } else if (!jiraPattern.test(prTitle)) { - core.setFailed('Cannot find a JIRA ticket in the PR title'); - }