Added template sign workflow (#8423)

* Added template sign workflow

* run upon push
patch-1
Sandeep Singh 2023-10-19 18:39:58 +05:30 committed by GitHub
parent ccb6a4683f
commit 68f707e895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 51 additions and 0 deletions

51
.github/workflows/template-sign.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: ☑️ Template Sign
on:
push:
branches:
- main
paths:
- '**.yaml'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
- name: nuclei install
run: go install -v github.com/projectdiscovery/nuclei/v2/cmd/nuclei@dev
- name: Template Sign
id: sign
run: |
nuclei -lfa -duc -sign -t /home/runner/work/nuclei-templates/nuclei-templates
nuclei -lfa -duc -t /home/runner/work/nuclei-templates/nuclei-templates
git status -s | wc -l | xargs -I {} echo CHANGES={} >> $GITHUB_OUTPUT
env:
NUCLEI_USER_CERTIFICATE: ${{ secrets.NUCLEI_USER_CERTIFICATE }}
NUCLEI_USER_PRIVATE_KEY: ${{ secrets.NUCLEI_USER_PRIVATE_KEY }}
- name: Commit files
if: steps.sign.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 Template Signing [$(date)] :robot:" -a
- name: Push changes
if: steps.sign.outputs.CHANGES > 0
run: |
git pull --rebase
git push origin ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}