Skip to content

Commit

Permalink
add(leave-comment): does not comment on commits
Browse files Browse the repository at this point in the history
  • Loading branch information
zakkarry committed Apr 13, 2024
1 parent f128cf6 commit 65d6f88
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/pr-naming-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
const title = context.payload.pull_request.title;
const isValid = titleRegex.test(title);
if (!isValid) {
console.error(`PR title "${title}" doesn't match the required format.`);
core.setFailed(`PR title "${title}" doesn't match the required format.`)
}
return isValid;
Expand All @@ -29,12 +29,14 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = context.payload.pull_request.number;
const author = context.payload.pull_request.user.login;
const message = `@${author} your pull request title "${context.payload.pull_request.title}" does not conform to our naming conventions (https://www.conventionalcommits.org/en/v1.0.0/).\n\nPlease update the title to match the pattern: "feat|build|chore|style|fix|update|ci(<area>): <description>"`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: message
});
if ((context.payload.action === 'opened') || (context.payload.action === 'reopened')) {
const prNumber = context.payload.pull_request.number;
const author = context.payload.pull_request.user.login;
const message = `@${author} your pull request title "${context.payload.pull_request.title}" does not conform to our naming conventions (https://www.conventionalcommits.org/en/v1.0.0/).\n\nPlease update the title to match the pattern: "feat|build|chore|style|fix|update|ci(<area>): <description>"`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: message
});
}

0 comments on commit 65d6f88

Please sign in to comment.