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." + }); + }