nuclei-templates/.github/workflows/cve2json.yml

46 lines
1.4 KiB
YAML
Raw Normal View History

name: 📝 CVE JSON Metadata
on:
push:
branches:
- main
paths:
2023-11-27 08:58:31 +00:00
- '*/cves/**'
2023-03-13 13:25:03 +00:00
workflow_dispatch: # allows manual triggering of the workflow
jobs:
cve2json:
runs-on: ubuntu-latest
if: github.repository == 'projectdiscovery/nuclei-templates'
steps:
2023-03-13 13:34:43 +00:00
- uses: actions/checkout@master
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.19
2023-01-18 03:32:45 +00:00
- name: Run YAML2JSON
id: cves
run: |
go env -w GO111MODULE=off
go get gopkg.in/yaml.v3
2023-09-26 04:41:05 +00:00
go run .github/scripts/yaml2json.go $GITHUB_WORKSPACE/http/cves/,$GITHUB_WORKSPACE/network/cves/ cves.json
md5sum cves.json | cut -d' ' -f1 > cves.json-checksum.txt
git status -s | wc -l | xargs -I {} echo CHANGES={} >> $GITHUB_OUTPUT
- name: Commit files
if: steps.cves.outputs.CHANGES > 0
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add cves.json cves.json-checksum.txt
git commit -m "Auto Generated cves.json [$(date)] :robot:" -a
- name: Push changes
2023-07-04 09:36:41 +00:00
if: steps.cves.outputs.CHANGES > 0
run: |
git pull --rebase
git push origin ${{ github.ref }}
env:
2023-09-26 04:41:05 +00:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}