Skip to content

Commit

Permalink
fix: Switch to git to get all commits
Browse files Browse the repository at this point in the history
The ${GITHUB_EVENT_PATH} JSON file only shows diff since last push,
not all commits for the entire feature branch.
  • Loading branch information
13rac1 committed Oct 1, 2019
1 parent 733aed1 commit 420d4a9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/git.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ jobs:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@master
- name: Block Fixup Merge
uses: 13rac1/block-fixup-merge-action@master
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM alpine:3.10

RUN apk add --no-cache \
bash \
jq
git
COPY entrypoint.sh /entrypoint.sh

CMD ["/entrypoint.sh"]
10 changes: 7 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
set -e
set -o pipefail
main() {
echo "Current branch: ${GITHUB_REF}"
echo "Current ref: ${GITHUB_REF}"
echo "Current branch: ${GITHUB_REF:11}"
# Using git directly because the $GITHUB_EVENT_PATH file only shows commits in
# most recent push.

FIXUP_COUNT=`jq .commits[].message ${GITHUB_EVENT_PATH} | grep fixup! | wc -l || true`
FIXUP_COUNT=`git log --pretty=format:%s origin/master..origin/${GITHUB_REF:11} | grep fixup! | wc -l || true`
echo "Fixup! commits: ${FIXUP_COUNT}"
if [ "$FIXUP_COUNT" -gt "0" ]; then
echo "Found Fixup! commits, failing"
git log --pretty=format:%s origin/master..origin/${GITHUB_REF:11} | grep fixup!
echo "failing..."
exit 1
fi
}
Expand Down

0 comments on commit 420d4a9

Please sign in to comment.