2022-12-07 09:24:33 +00:00
|
|
|
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
|
2022-12-07 09:24:33 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-05-11 13:01:52 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-01-15 16:05:57 +00:00
|
|
|
- name: Set up Go
|
2023-03-20 06:02:51 +00:00
|
|
|
uses: actions/setup-go@v4
|
2023-01-15 16:05:57 +00:00
|
|
|
with:
|
|
|
|
go-version: 1.19
|
2022-12-07 09:24:33 +00:00
|
|
|
|
|
|
|
- name: install checksum generator
|
|
|
|
run: |
|
|
|
|
go install -v github.com/projectdiscovery/nuclei/v2/cmd/generate-checksum@dev
|
|
|
|
|
|
|
|
- name: generate checksum
|
2023-05-11 13:01:52 +00:00
|
|
|
id: checksum
|
2022-12-07 09:24:33 +00:00
|
|
|
run: |
|
|
|
|
generate-checksum /home/runner/work/nuclei-templates/nuclei-templates/ templates-checksum.txt
|
2023-05-11 13:01:52 +00:00
|
|
|
git status -s | wc -l | xargs -I {} echo CHANGES={} >> $GITHUB_OUTPUT
|
2022-12-07 09:24:33 +00:00
|
|
|
|
|
|
|
- name: Commit files
|
2023-05-11 13:01:52 +00:00
|
|
|
if: steps.checksum.outputs.CHANGES > 0
|
2022-12-07 09:24:33 +00:00
|
|
|
run: |
|
|
|
|
git add templates-checksum.txt
|
|
|
|
git config --local user.email "action@github.com"
|
|
|
|
git config --local user.name "GitHub Action"
|
|
|
|
git commit -m "Auto Generated Templates Checksum [$(date)] :robot:" -a
|
|
|
|
|
|
|
|
- name: Push changes
|
|
|
|
uses: ad-m/github-push-action@master
|
|
|
|
with:
|
2023-03-18 09:21:32 +00:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|