Skip to content

Refresh ATT&CK data #2293

Refresh ATT&CK data

Refresh ATT&CK data #2293

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 }}