Skip to content

Add github commit validation for missing Jira id #1612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/check-commit-message.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check Commit Message for "LMCROSSITXSADEPLOY"

on:
pull_request:
types: [synchronize, opened]

jobs:
check_commit_message:
name: Check Commit Message
runs-on: ubuntu-latest

steps:
- name: Check Commit Message
id: commits
uses: actions/github-script@v6
with:
script: |
const prNumber = context.payload.pull_request.number;
const commits = await github.rest.pulls.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});

let containsText = false;
for (const commitData of commits.data) {
if (commitData.commit.message.includes("LMCROSSITXSADEPLOY")) {
containsText = true;
break;
}
}

if (!containsText) {
core.setFailed("❌ Check Commit Message - Failed: At least one commit must contain the word 'LMCROSSITXSADEPLOY'.");
}
Loading