From fd3ba3bfb8d60fa0e51d9521602032190f140ed0 Mon Sep 17 00:00:00 2001 From: SquidSpirit Date: Tue, 21 Jan 2025 08:21:51 +0800 Subject: [PATCH] NO-ISSUE Create title check workflow (#30) ### Description - The validation regex is `^(BLOG-[0-9]+|NO-ISSUE) [A-Z].+$` ### Package Changes _No response_ ### Screenshots _No response_ ### Reference _No issue_ ### Checklist - [x] The title is meet the format `'BLOG-XXX Title title title'` - [ ] A milestone is set - [ ] The related issuse has been linked to this branch Reviewed-on: https://git.squidspirit.com/squid/blog/pulls/30 Co-authored-by: SquidSpirit Co-committed-by: SquidSpirit --- .gitea/PULL_REQUEST_TEMPLATE.yaml | 1 - .gitea/workflows/pr-title-check.yaml | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/pr-title-check.yaml diff --git a/.gitea/PULL_REQUEST_TEMPLATE.yaml b/.gitea/PULL_REQUEST_TEMPLATE.yaml index 06b9d67..e470377 100644 --- a/.gitea/PULL_REQUEST_TEMPLATE.yaml +++ b/.gitea/PULL_REQUEST_TEMPLATE.yaml @@ -33,6 +33,5 @@ body: attributes: label: Checklist options: - - label: "The title is meet the format `'BLOG-XXX Title title title'`" - label: A milestone is set - label: The related issuse has been linked to this branch diff --git a/.gitea/workflows/pr-title-check.yaml b/.gitea/workflows/pr-title-check.yaml new file mode 100644 index 0000000..fcf0a95 --- /dev/null +++ b/.gitea/workflows/pr-title-check.yaml @@ -0,0 +1,20 @@ +name: PR Title Check +on: + pull_request: + types: + - opened + - edited + - synchronize + - reopened + +jobs: + pr-title-check: + runs-on: ubuntu-latest + steps: + - name: Check PR title + run: | + title="${{ gitea.event.pull_request.title }}" + echo "Checking PR title: $title" + echo "$title" | grep -qE '^(BLOG-[0-9]+|NO-ISSUE) [A-Z].+$' \ + && echo 'Pass' \ + || (echo 'The title is not meet the format `BLOG-XXX Title title title`'; exit 1)