nuclei-templates/.github/workflows/template-checksum.yml

50 lines
1.4 KiB
YAML
Raw Normal View History

name: 📝 Template Checksum
on:
push:
2023-03-18 09:19:20 +00:00
branches:
- main
paths:
- '**.yaml'
workflow_dispatch: # allows manual triggering of the workflow
jobs:
2023-06-03 18:06:19 +00:00
checksum:
runs-on: ubuntu-latest
if: github.repository == 'projectdiscovery/nuclei-templates'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
2023-01-15 16:05:57 +00:00
- name: Set up Go
uses: actions/setup-go@v5
2023-01-15 16:05:57 +00:00
with:
2023-10-30 12:01:26 +00:00
go-version: 1.21.x
- name: install checksum generator
run: |
2024-04-23 10:04:31 +00:00
go install -v github.com/projectdiscovery/nuclei/v3/cmd/generate-checksum@latest
- name: generate checksum
id: checksum
run: |
generate-checksum /home/runner/work/nuclei-templates/nuclei-templates/ templates-checksum.txt
git status -s | wc -l | xargs -I {} echo CHANGES={} >> $GITHUB_OUTPUT
- name: Commit files
if: steps.checksum.outputs.CHANGES > 0
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
2023-06-03 18:41:10 +00:00
git add templates-checksum.txt
git commit -am "Auto Generated Templates Checksum [$(date)] :robot:"
- name: Push changes
if: steps.checksum.outputs.CHANGES > 0
run: |
git pull --rebase
git push origin ${{ github.ref }}
env:
2024-04-23 10:04:31 +00:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}