forked from valhalla/valhalla
-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (36 loc) · 1.51 KB
/
ci.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
38
39
40
41
42
43
name: GitHub CI
on: [pull_request]
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Validate changelog
shell: bash
run: |
# we dont enforce this on a draft
if [[ "$(jq --raw-output .pull_request.draft ${GITHUB_EVENT_PATH})" == "true" ]]; then
exit 0
fi
# get some info about the pr
PR_BASE=$(jq --raw-output .pull_request.base.ref ${GITHUB_EVENT_PATH})
PR_NUMBER=$(jq --raw-output .pull_request.number ${GITHUB_EVENT_PATH})
PR_TITLE=$(jq --raw-output .pull_request.title ${GITHUB_EVENT_PATH})
# check if anything has changed against the base branch for the changelog
git fetch origin ${PR_BASE} --depth 1
LINE_COUNT=$(git diff origin/${PR_BASE} -- CHANGELOG.md | wc -l)
# no entry in the changelog is bad in most cases, lets suggest an entry
if [ ${LINE_COUNT} -eq 0 ]; then
printf "\x1b[31;1mNo CHANGELOG entries detected. Consider whether this PR warrents one, for example:\x1b[0m\n"
printf "\x1b[33;1m* ${PR_TITLE} [#${PR_NUMBER}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/${PR_NUMBER})\x1b[0m\n"
exit 1
fi
#TODO: validate changelog line format
spell-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Spell-check
uses: crate-ci/typos@master
with:
config: ./.github/workflows/typos.toml