-
Notifications
You must be signed in to change notification settings - Fork 43
39 lines (33 loc) · 1.11 KB
/
check-commit-message.yml
File metadata and controls
39 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Check Commit Message for "LMCROSSITXSADEPLOY"
on:
pull_request:
types: [synchronize, opened]
permissions: {}
jobs:
check_commit_message:
name: Check Commit Message
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Check Commit Message
id: commits
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # 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'.");
}