2023-06-20 12:53:35 +00:00
|
|
|
name: 📝 CVE JSON Metadata
|
2023-01-18 03:10:28 +00:00
|
|
|
|
|
|
|
on:
|
2023-02-19 00:57:32 +00:00
|
|
|
push:
|
2023-02-19 08:45:04 +00:00
|
|
|
branches:
|
|
|
|
- main
|
2023-02-19 00:57:32 +00:00
|
|
|
paths:
|
2023-07-04 09:34:02 +00:00
|
|
|
- 'http/cves/**'
|
2023-03-13 13:25:03 +00:00
|
|
|
workflow_dispatch: # allows manual triggering of the workflow
|
2023-01-18 03:10:28 +00:00
|
|
|
|
|
|
|
jobs:
|
2023-02-19 08:45:04 +00:00
|
|
|
cve2json:
|
2023-01-18 03:10:28 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-07-12 20:22:59 +00:00
|
|
|
if: github.repository == 'projectdiscovery/nuclei-templates'
|
2023-01-18 03:10:28 +00:00
|
|
|
steps:
|
2023-03-13 13:34:43 +00:00
|
|
|
- uses: actions/checkout@master
|
2023-01-18 03:10:28 +00:00
|
|
|
- name: Set up Go
|
2023-03-20 06:02:51 +00:00
|
|
|
uses: actions/setup-go@v4
|
2023-01-18 03:10:28 +00:00
|
|
|
with:
|
|
|
|
go-version: 1.19
|
2023-01-18 03:32:45 +00:00
|
|
|
|
2023-06-20 12:53:35 +00:00
|
|
|
- name: Run YAML2JSON
|
|
|
|
id: cves
|
2023-01-18 03:10:28 +00:00
|
|
|
run: |
|
2023-06-20 12:53:35 +00:00
|
|
|
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
|
2023-06-20 12:53:35 +00:00
|
|
|
md5sum cves.json | cut -d' ' -f1 > cves.json-checksum.txt
|
|
|
|
git status -s | wc -l | xargs -I {} echo CHANGES={} >> $GITHUB_OUTPUT
|
2023-01-18 03:10:28 +00:00
|
|
|
|
|
|
|
- name: Commit files
|
2023-06-20 12:53:35 +00:00
|
|
|
if: steps.cves.outputs.CHANGES > 0
|
2023-01-18 03:10:28 +00:00
|
|
|
run: |
|
|
|
|
git config --local user.email "action@github.com"
|
|
|
|
git config --local user.name "GitHub Action"
|
2023-06-20 12:53:35 +00:00
|
|
|
git add cves.json cves.json-checksum.txt
|
2023-01-18 03:10:28 +00:00
|
|
|
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
|
2023-06-20 12:53:35 +00:00
|
|
|
run: |
|
|
|
|
git pull --rebase
|
|
|
|
git push origin ${{ github.ref }}
|
|
|
|
env:
|
2023-09-26 04:41:05 +00:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|