From 5b340afc07e488624d3e0ab51cedd10e318661a9 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Fri, 22 Aug 2025 09:28:22 +0200 Subject: [PATCH] .github/workflows: naive PR format checker --- .github/workflows/validate_pr.yml | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/validate_pr.yml diff --git a/.github/workflows/validate_pr.yml b/.github/workflows/validate_pr.yml new file mode 100644 index 0000000000..d41b4f307a --- /dev/null +++ b/.github/workflows/validate_pr.yml @@ -0,0 +1,50 @@ +name: PR Format Validation + +on: + pull_request: + types: [opened, edited, synchronize] + +jobs: + validate-pr: + runs-on: ubuntu-latest + steps: + - name: Check PR Title Format + uses: actions/github-script@v7 + with: + script: | + const prTitle = context.payload.pull_request.title; + const titleRegex = /^([\w\s,{}]?): .+/; + + if (!titleRegex.test(prTitle)) { + core.setFailed(`PR title "${prTitle}" does not match required format: type(scope): description`); + return; + } + + console.log('✅ PR title format is valid'); + + - name: Check Milestone Assignment + uses: actions/github-script@v7 + with: + script: | + const milestone = context.payload.pull_request.milestone; + + if (!milestone) { + core.setFailed('PR must have a milestone assigned'); + return; + } + + console.log(`✅ Milestone "${milestone.title}" is assigned`); + + - name: Update PR Status + if: success() + uses: actions/github-script@v7 + with: + script: | + github.rest.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.payload.pull_request.head.sha, + state: 'success', + description: 'PR validation passed', + context: 'pr-validation' + });