cti-stix-commom-objects daily update #12760
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cti-stix-commom-objects daily update | |
on: | |
schedule: | |
- cron: "59 * * * *" | |
# At the end of every day | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Update Stix Commom Objects Repository | |
steps: | |
- name: Get Current Date | |
id: date | |
run: echo "::set-output name=today::$(date +'%Y-%m-%d')" | |
- name: Checkout STIX Common Objects Repo | |
uses: actions/checkout@v2 | |
- name: Checkout CVE Repo | |
uses: actions/checkout@v2 | |
with: | |
repository: CVEProject/cvelist | |
path: './cvelist' | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install and update essential dependencies | |
run: | | |
pip install -U pip setuptools wheel | |
pip install pycountry stix2 stix2-validator | |
- name: Run Updater | |
run: | | |
python scripts/generate_common_objects.py -r mapping.csv ./cvelist objects | |
- name: Delete CVE Repo | |
run: | | |
rm -rf cvelist/ | |
- name: Git Add New Files and Git Status | |
run: | | |
git add . | |
git status | |
- name: Validate STIX Content | |
run: | | |
python scripts/validate_content.py -v "--version 2.1" | |
- name: Configure Git and Commit Changes | |
if: ${{ success() }} | |
id: git-commit-run | |
continue-on-error: true | |
run: | | |
git config user.name gitadvisor | |
git config user.email alerts@log4j.codes | |
git commit -m "generated content from ${{ steps.date.outputs.today }}" | |
- name: Push Changes if Found | |
if: steps.git-commit-run.outcome == 'success' && steps.git-commit-run.conclusion == 'success' | |
run: | | |
git push |