From 7d2d59ba5c7f1a6102bd1582600904d3d9c1fb1f Mon Sep 17 00:00:00 2001 From: Soma Utsumi <53121322+soma00333@users.noreply.github.com> Date: Tue, 4 Feb 2025 00:24:00 +0900 Subject: [PATCH] ci: add issue title check (#273) **Commit Message** This introduces a new GitHub Actions workflow to check the length of issue titles and provide feedback if they exceed a specified limit. **Related Issues/PRs (if applicable)** Fixes https://github.com/envoyproxy/ai-gateway/issues/270 --------- Signed-off-by: soma00333 Signed-off-by: Loong --- .github/workflows/issue_title_check.yaml | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/issue_title_check.yaml diff --git a/.github/workflows/issue_title_check.yaml b/.github/workflows/issue_title_check.yaml new file mode 100644 index 000000000..129ab6728 --- /dev/null +++ b/.github/workflows/issue_title_check.yaml @@ -0,0 +1,36 @@ +name: Issue Title Check + +on: + issues: + types: [opened, edited] + +permissions: + issues: write + +jobs: + check_title_length: + runs-on: ubuntu-latest + steps: + - name: Check Issue Title Length + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const issueNumber = context.issue.number; + const repoOwner = context.repo.owner; + const repoName = context.repo.repo; + + const issueTitle = context.payload.issue.title; + const length = issueTitle.length; + + console.log(`Title: ${issueTitle}`); + console.log(`Length: ${length}`); + + if (length >= 60) { + await github.rest.issues.createComment({ + owner: repoOwner, + repo: repoName, + issue_number: issueNumber, + body: "The issue title is too long (over 60 characters). Please shorten it and ensure it is well summarized." + }); + }