Skip to content

Commit

Permalink
ci: add issue title check (envoyproxy#273)
Browse files Browse the repository at this point in the history
**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 envoyproxy#270

---------

Signed-off-by: soma00333 <soma03432303@gmail.com>
Signed-off-by: Loong <long0dai@foxmail.com>
  • Loading branch information
soma00333 authored and daixiang0 committed Feb 19, 2025
1 parent b1f3f43 commit 7d2d59b
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/issue_title_check.yaml
Original file line number Diff line number Diff line change
@@ -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."
});
}

0 comments on commit 7d2d59b

Please sign in to comment.