-
Notifications
You must be signed in to change notification settings - Fork 341
90 lines (77 loc) · 2.84 KB
/
refresh_ATTCK_data.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
name: Refresh ATT&CK data
on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_TOKEN }}
- name: Checkout the Wiki
uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_TOKEN }}
repository: ${{github.repository}}.wiki
path: wiki
- name: Clone STIX repo
uses: actions/checkout@v3
with:
repository: mitre-attack/attack-stix-data
path: attack-stix-data
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./.github/workflows/scripts/requirements_refresh_attack_data.txt
- name: Refresh ATT&CK data (JSON files and Wiki)
working-directory: ./.github/workflows/scripts
run: |
python refresh_attack_data.py --local-stix-path /home/runner/work/DeTTECT/DeTTECT/attack-stix-data
rm -rf /home/runner/work/DeTTECT/DeTTECT/attack-stix-data
- name: Wiki - check for changes
id: changeswiki
working-directory: ./wiki
run: |
OUTPUT=`git status`
echo ::set-output name=GIT_STATUS_WIKI::${OUTPUT}
echo $OUTPUT
- name: Wiki - commit files (if applicable)
if: contains(steps.changeswiki.outputs.GIT_STATUS_WIKI, 'modified')
working-directory: ./wiki
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -m "Update Wiki text"
- name: Wiki - push changes (if applicable)
if: contains(steps.changeswiki.outputs.GIT_STATUS_WIKI, 'modified')
uses: SwiftDocOrg/github-wiki-publish-action@v1
with:
path: "wiki"
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
- name: JSON data - check for changes
id: changesjson
run: |
OUTPUT=`git status`
echo ::set-output name=GIT_STATUS_CODE::${OUTPUT}
echo $OUTPUT
- name: JSON data - commit files (if applicable)
if: contains(steps.changesjson.outputs.GIT_STATUS_CODE, 'modified')
run: |
rm -rf wiki
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -m "Refresh ATT&CK json data files"
- name: JSON data - push changes (if applicable)
if: contains(steps.changesjson.outputs.GIT_STATUS_CODE, 'modified')
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PERSONAL_TOKEN }}