11name : Commit messages check
22on :
3- pull_request :
4- workflow_call :
3+ pull_request :
4+ workflow_call :
55
66jobs :
7- gitlint :
8- name : Check commit messages
9- runs-on : ubuntu-latest
10- steps :
11- - name : Checkout repository
12- uses : actions/checkout@v4
13- with :
14- fetch-depth : 0
15- - name : Install dependencies
16- run : |
17- pip install --upgrade gitlint
18- - name : Lint git commit messages
19- shell : bash
20- # run the linter and tee the output to a file, this will make the check fail but allow us to use the results in summary
21- run : gitlint --ignore body-is-missing --commits origin/$GITHUB_BASE_REF.. 2>&1 | tee check_results.log
22- - name : Propegate Error Summary
23- if : always()
24- shell : bash
25- # put the output of the commit message linting into the summary for the job and in an environment variable
26- run : |
27- # Change the commit part of the log into a markdown link to the commit
28- commitsUrl="https:\/\/github.com\/${{ github.repository_owner }}\/${{ github.event.repository.name }}\/commit\/"
29- sed -i "s/Commit \([0-9a-f]\{7,40\}\)/[commit \1]($commitsUrl\1)/g" check_results.log
30- # Put the results into the job summary
31- cat check_results.log >> "$GITHUB_STEP_SUMMARY"
32- # Put the results into a multi-line environment variable to use in the next step
33- echo "check_results<<###LINT_DELIMITER###" >> "$GITHUB_ENV"
34- echo "$(cat check_results.log)" >> "$GITHUB_ENV"
35- echo "###LINT_DELIMITER###" >> "$GITHUB_ENV"
36- # add a comment on the PR if the commit message linting failed
37- - name : Comment on PR
38- if : failure()
39- uses : marocchino/sticky-pull-request-comment@v2
40- with :
41- header : Commit Comment
42- message : |
43- ⚠️ Commit Message Format Issues ⚠️
44- ${{ env.check_results }}
45- - name : Clear PR Comment
46- if : success()
47- uses : marocchino/sticky-pull-request-comment@v2
48- with :
49- header : Commit Comment
50- hide : true
51- hide_classify : " RESOLVED"
52-
7+ gitlint :
8+ name : Check commit messages
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : Checkout repository
12+ uses : actions/checkout@v4
13+ with :
14+ fetch-depth : 0
15+ - name : Install dependencies
16+ run : |
17+ pip install --upgrade gitlint
18+ - name : Lint git commit messages
19+ shell : bash
20+ run : bash ./Build/Agent/commit-messages.sh
21+ - name : Propegate Error Summary
22+ if : always()
23+ shell : bash
24+ # put the output of the commit message linting into the summary for the job and in an environment variable
25+ run : |
26+ # Change the commit part of the log into a markdown link to the commit
27+ commitsUrl="https:\/\/github.com\/${{ github.repository_owner }}\/${{ github.event.repository.name }}\/commit\/"
28+ sed -i "s/Commit \([0-9a-f]\{7,40\}\)/[commit \1]($commitsUrl\1)/g" check_results.log
29+ # Put the results into the job summary
30+ cat check_results.log >> "$GITHUB_STEP_SUMMARY"
31+ # Put the results into a multi-line environment variable to use in the next step
32+ echo "check_results<<###LINT_DELIMITER###" >> "$GITHUB_ENV"
33+ echo "$(cat check_results.log)" >> "$GITHUB_ENV"
34+ echo "###LINT_DELIMITER###" >> "$GITHUB_ENV"
35+ # add a comment on the PR if the commit message linting failed
36+ - name : Comment on PR
37+ if : failure()
38+ uses : marocchino/sticky-pull-request-comment@v2
39+ with :
40+ header : Commit Comment
41+ message : |
42+ ⚠️ Commit Message Format Issues ⚠️
43+ ${{ env.check_results }}
44+ - name : Clear PR Comment
45+ if : success()
46+ uses : marocchino/sticky-pull-request-comment@v2
47+ with :
48+ header : Commit Comment
49+ hide : true
50+ hide_classify : " RESOLVED"
0 commit comments