name: Linear ticket on: pull_request: types: [opened, edited, reopened, synchronize] branches: [main] permissions: pull-requests: read jobs: linear-ticket: name: Check Linear ticket link runs-on: ubuntu-latest if: github.event.pull_request.user.type != 'Bot' steps: - name: Require a Linear ticket reference or an explicit opt-out uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: script: | const pr = context.payload.pull_request; const text = `${pr.title}\n${pr.body ?? ""}\n${pr.head.ref}`; const ticket = /\bres-\d+\b|linear\.app\/[\w-]+\/issue\/res-\d+/i; const optOut = /^\s*No-Ticket:\s*\S.*$/im; if (ticket.test(text)) { core.info("Linear ticket reference found."); return; } const match = (pr.body ?? "").match(optOut); if (match) { core.info(`No-ticket opt-out present: ${match[0].trim()}`); return; } core.setFailed( [ "No Linear ticket is linked in this pull request.", "Prime Agent tickets should normally use the Research team and the Prime Agent: Long-Horizon research project.", "Add the ticket ID (e.g. RES-1234) or a linear.app issue link to the PR title or description,", "or use a branch named after the ticket (e.g. res-1234).", 'If this change genuinely has no ticket, add a line to the PR description: "No-Ticket: ".', ].join(" "), );