-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (54 loc) · 1.75 KB
/
Coverage.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
name: Update gh-pages.
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout sigma-rule-coverage
uses: actions/checkout@v4
with:
path: sigma-rule-coverage
- name: Checkout sigma-rule-coverage (gh-phages)
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: gh-pages
path: sigma-rule-coverage-gh-pages
- name: Checkout sigma
uses: actions/checkout@v4
with:
repository: SigmaHQ/sigma
path: sigma
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install Poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: "1.7.1"
- name: Install
working-directory: sigma-rule-coverage
run: poetry install
- name: Build
working-directory: sigma-rule-coverage
run: |
# Activate poetry shell from sigma-rule-coverage in this shell
. $(poetry env info --path)/bin/activate
# Copy rules
chmod +x $GITHUB_WORKSPACE/sigma-rule-coverage/rule-coverage.py
$GITHUB_WORKSPACE/sigma-rule-coverage/rule-coverage.py --rules "$GITHUB_WORKSPACE/sigma/rules" --output "$GITHUB_WORKSPACE/sigma-rule-coverage-gh-pages/data/model.json"
- name: Push
working-directory: sigma-rule-coverage-gh-pages
run: |
# Prepare Git environment
git config --global user.email "github.action@localhost.local"
git config --global user.name "CI"
# Git add and commit.
git add .
git commit -m "Updated model.json" || true
git config --global --add --bool push.autoSetupRemote true || true
git push