New Action to refresh the Editor's ATT&CK data

master
Marcus Bakker 2020-07-20 10:42:14 +02:00
parent a341af5a12
commit df96008366
2 changed files with 47 additions and 2 deletions

View File

@ -21,7 +21,7 @@ jobs:
# set up NodeJS
- uses: actions/setup-node@master
- name: Instal project dependencies
- name: Install project dependencies
run: npm install
working-directory: ./editor
@ -29,7 +29,7 @@ jobs:
run: npm run build
working-directory: ./editor
- name: Peform post build actions
- name: Perform post build actions
run: rm -r node_modules
working-directory: ./editor

View File

@ -0,0 +1,45 @@
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@master
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/src/data/requirements.txt
- name: Refresh ATT&CK Data
working-directory: ./editor/src/data
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 }}