-
Notifications
You must be signed in to change notification settings - Fork 3
51 lines (42 loc) · 1.36 KB
/
ci-on-pr.yaml
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
44
45
46
47
48
49
50
51
name: CI (pull request)
on:
pull_request:
branches: ['**']
paths:
- .github/**
- ccHFM/**
workflow_dispatch:
repository_dispatch:
jobs:
merge-check:
name: Merge check
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 2 # to compute the differences
- name: Debug dump
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "Where am I: $GITHUB_REF, $GITHUB_SHA"
git log
- name: Run static analysis tool
uses: ./.github/actions/pds-companion
with:
script: |
# fail on first error
set -Eeuo pipefail
# compute difference
readarray -d "" pr_files < <(git diff-tree -z --no-commit-id --name-only --diff-filter=AM -r HEAD~1 HEAD -- ccHFM/)
if (( "${#pr_files[@]}" == 0 )) ; then
echo "No mod files to test."
exit
fi
echo "## PR: fresh mod files ##"
printf " %q\n" "${pr_files[@]}"
# the static analysis tool uses these for finer analysis
scaffolding=(ccHFM/common/cb_types.txt)
# run static analysis
vic2-companion --color=always --heartbeat --whitelist --remarks=opinion "${scaffolding[@]}" "${pr_files[@]}"