-
Notifications
You must be signed in to change notification settings - Fork 2.7k
83 lines (78 loc) · 2.42 KB
/
tests.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
name: 🛠 Tests
on:
pull_request:
paths:
- '**.yaml'
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
if: github.repository == 'projectdiscovery/nuclei-templates'
steps:
- uses: actions/checkout@v4
- uses: karancode/yamllint-github-action@v2.1.1
with:
yamllint_config_filepath: .yamllint
yamllint_strict: false
yamllint_comment: true
validate:
needs: lint
runs-on: ubuntu-latest
if: github.repository == 'projectdiscovery/nuclei-templates'
steps:
- uses: actions/checkout@v4
- uses: projectdiscovery/actions/setup/nuclei@v1
with:
token: '${{ secrets.GITHUB_TOKEN }}'
- name: Validate templates
run: nuclei -duc -validate -lfa -ud $GITHUB_WORKSPACE -w workflows/ -et .github/
weak-matcher-checks:
needs: lint
runs-on: ubuntu-latest
if: github.repository == 'projectdiscovery/nuclei-templates'
permissions:
issues: write
pull-requests: write
env:
HONEYPOT_URL: 'http://honey.scanme.sh'
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
list-files: shell
filters: |
templates: &templates
- '**.yml'
- '**.yaml'
- '!.github/**'
changed:
- added|modified: *templates
- uses: projectdiscovery/actions/setup/nuclei@v1
with:
token: '${{ secrets.GITHUB_TOKEN }}'
- run: bash weak-matcher-checks.sh
id: check
if: steps.filter.outputs.changed == 'true'
env:
CHANGED_FILES: '${{ steps.filter.outputs.changed_files }}'
working-directory: '.github/scripts/'
- uses: actions/github-script@v7
if: steps.check.outputs.weak == 'true'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.COMMENT
})
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['false-positive']
})
env:
COMMENT: '${{ steps.check.outputs.comment }}'
GITHUB_TOKEN: '${{ secrets.ACCESS_TOKEN }}'