Files
nuclei-templates/.github/workflows/cve2json.yml
Dwi Siswanto f6b92f751a ci(cve2json): add branch restriction & minor changes (#6770)
This commit updates the cve2json GitHub workflow to add a branch
restriction for `main` branch, thus we don't need to spesify
`branch` input for `ad-m/github-push-action` step & change
the filepath for the `yaml2json.go` script.

The changes ensure that the workflow only runs on the `main`
branch & simply use `$GITHUB_WORKSPACE` variable as a filepath
for generating the JSON metadata of CVE templates.
2023-02-19 14:15:04 +05:30

39 lines
997 B
YAML

name: Generate JSON Metadata of CVE Templates
on:
push:
branches:
- main
paths:
- 'cves/**'
jobs:
cve2json:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
check-latest: true
- name: run yaml2json.go to generate cves.json
run: |
go env -w GO111MODULE=off
go get gopkg.in/yaml.v3
go run .github/scripts/yaml2json.go $GITHUB_WORKSPACE/cves/ cves.json
- name: Commit files
run: |
git pull
git add cves.json
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -m "Auto Generated cves.json [$(date)] :robot:" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}