DeTTECT/.github/workflows/refresh_Editor_ATTCK_data.yml

45 lines
1.6 KiB
YAML

name: Refresh Editor ATT&CK data
on:
workflow_dispatch:
schedule:
- cron: '0 */12 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./editor/script/requirements.txt
- name: Refresh ATT&CK Data
working-directory: ./editor/script
run: |
python refresh_attack_data.py
- name: Check for changes
id: changes
run: |
OUTPUT=`git status`
echo ::set-output name=GIT_STATUS::${OUTPUT}
echo $OUTPUT
- name: Commit files (if applicable)
if: contains(steps.changes.outputs.GIT_STATUS, 'modified')
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -m "Refresh Editor ATT&CK data"
- name: Push changes (if applicable)
if: contains(steps.changes.outputs.GIT_STATUS, 'modified')
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PERSONAL_TOKEN }}