-
Notifications
You must be signed in to change notification settings - Fork 10
37 lines (37 loc) · 1.3 KB
/
lint.yml
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
name: lint
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
commit-lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 50
- name: copy scripts
run: cp ci/.github/*.sh .github/
- name: assert contributors
run: .github/assert-contributors.sh
- name: lint commit message
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then
echo "This is a pull request build"
base_sha=$(git show --pretty=raw | grep '^parent' | cut -f2 -d' ' | sed -n '1p')
head_sha=$(git show --pretty=raw | grep '^parent' | cut -f2 -d' ' | sed -n '2p')
export TRAVIS_COMMIT_RANGE=${base_sha}...${head_sha}
else
echo "This is a branch build"
git fetch --depth=50 origin ${{ github.ref }}
export TRAVIS_COMMIT_RANGE=$(git log --format="%H" | tail -n1)...${{ github.ref }}
fi
echo "Emulated TRAVIS_COMMIT_RANGE: ${TRAVIS_COMMIT_RANGE}"
git log --oneline --graph ${TRAVIS_COMMIT_RANGE}
echo "Linting commit message"
.github/lint-commit-message.sh