From ba4b7d9e2e8be9eff610bf2028d9f735a88ba987 Mon Sep 17 00:00:00 2001 From: Nemo Date: Thu, 5 Jan 2023 18:10:34 +0530 Subject: [PATCH] Add automation --- .github/workflows/update.yml | 30 ++++++++++++++++++++++++++++++ main.py | 1 - 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/update.yml diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..3ca129b --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,30 @@ +name: Update Data +on: + workflow_dispatch: + push: + schedule: + # Once an hour:35 + - cron: '35 * * * *' +jobs: + update: + name: Update data + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Update data + run: | + mkdir -p advisories + python main.py + id: update_advisories + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Update Advisories + commit_author: 'github-actions[bot] ' + file_pattern: "advisories/*.json" + skip_fetch: true + skip_checkout: true \ No newline at end of file diff --git a/main.py b/main.py index abfd435..0f70a3d 100644 --- a/main.py +++ b/main.py @@ -3,7 +3,6 @@ import json import re import datetime - TITLE_REGEX = r"\[(?P\d+ \w+ \d{4})\] (?PELA-\d+-\d+) (?P[\w\-\.]+) - (?P[\w ]+)" CVE_REGEX = r"CVE-\d{4}-\d{4,7}" DETAILS_REGEX = r"\[(?P\w+)\] - (?P[\w\-\.]+) (?P(?:(?:[0-9]{1,9}):)?(?:[0-9][0-9a-z\.+~-]*)(?:(?:-[0-0a-z\.+~]+))?)"