forked from semgrep/semgrep
-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (88 loc) · 2.96 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: lint
on:
workflow_dispatch:
pull_request:
push:
branches:
- develop
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Fetch semgrep-cli submodules
run: git submodule update --init --recursive --recommend-shallow cli/src/semgrep/lang cli/src/semgrep/semgrep_interfaces
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: .github/workflows/lint.yml
- uses: pre-commit/action@v3.0.0
pre-commit-manual:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: .github/workflows/lint.yml
- uses: pre-commit/action@v3.0.0
with:
extra_args: --hook-stage manual
pre-commit-ocaml:
runs-on: ubuntu-latest
# Custom image provides 'ocamlformat' with a specific version needed to check
# ocaml code (must be the same than the one in semgrep-core/dev/dev.opam)
container: returntocorp/ocaml:ubuntu-2022-06-09
steps:
- name: Pre-checkout fixes
run: |
sudo chmod -R 777 /github
github_cache_dir="/__w"
sudo mkdir -p "$github_cache_dir"
sudo chmod -R 777 "$github_cache_dir"
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check OCaml code
run: |
sudo -u user git config --global --add safe.directory "$GITHUB_WORKSPACE"
# install correct version of ocamlformat
sudo -u user opam install -y ocamlformat.0.21.0
sudo -u user opam exec -- pre-commit run --verbose --all lint-ocaml
changelog-reminder:
name: Changelog Reminder
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- id: semgrep_diff
name: Get semgrep package diff
uses: technote-space/get-diff-action@v6.1.0
with:
GET_FILE_DIFF: true
PATTERNS: cli/src/semgrep/**
- id: changelog_diff
name: Get changelog diff
uses: technote-space/get-diff-action@v6.1.0
with:
GET_FILE_DIFF: true
FILES: CHANGELOG.md
- name: Send reminder
uses: unsplash/comment-on-pr@v1.3.1
if: >
steps.semgrep_diff.outputs.insertions > 20
&& steps.changelog_diff.outputs.insertions == 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: You added quite a few lines in semgrep, but didn't update the changelog. Consider doing so!
check_for_duplicate_msg: yes