This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." | |
}); | |
} |