Skip to content

Commit

Permalink
chore(build): add LOGFROM flag to check-pr rule (#3348)
Browse files Browse the repository at this point in the history
With this flag, the git log output is filtered to only include commits
from the specified commit to the current HEAD.

make check-pr                # from main (default)
make check-pr LOGFROM=v0.1.0 # from tag/branch
make check-pr LOGFROM=HEAD~1 # from commit
make check-pr LOGFROM=f3a4b2 # from commit

This also changes check-pr output format and adds information for using
its output in the PULL_REQUEST_TEMPLATE.md file.
  • Loading branch information
geyslan committed Jul 28, 2023
1 parent 41ea796 commit 8e2086a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ PS: DO NOT JUMP THE CHECKLIST. GO BACK AND READ, ALWAYS!

### 1. Explain what the PR does

<!-- Best advice is to put copy & paste your very well written git logs -->
<!-- Best advice is to put copy & paste "make check-pr" PR Comment output -->

"Replace me with `make check-pr` output"

### 2. Explain how to test it

Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,8 @@ check-err: \
# pull request verifier
#

LOGFROM ?= main

.PHONY: check-pr
check-pr: \
check-fmt check-lint check-code \
Expand All @@ -868,9 +870,14 @@ check-pr: \
@echo

@$(CMD_GIT) \
log main..HEAD \
--pretty=format:'%C(auto,yellow)%h%Creset **%C(auto,red)%s%Creset** _<sub>%C(auto,cyan)(%ad)%Creset %C(auto,green)%an \<%ae\>%Creset</sub>_%n%n```%n%b```%n' \
--date=format:"%Y/%b/%d"
log $(LOGFROM)..HEAD \
--pretty=format:'%C(auto,yellow)%h%Creset **%C(auto,red)%s%Creset**'

@echo

@$(CMD_GIT) \
log $(LOGFROM)..HEAD \
--pretty=format:'commit %C(auto,yellow)%h%Creset%n%n```%n%b```%n'

@echo
@echo "*** PR Comment END"
Expand Down

0 comments on commit 8e2086a

Please sign in to comment.