Merge pull request #8309 from projectdiscovery/dns_fix #1037
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 📝 Template Checksum | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**.yaml' | |
workflow_dispatch: # allows manual triggering of the workflow | |
jobs: | |
checksum: | |
runs-on: ubuntu-latest | |
if: github.repository == 'projectdiscovery/nuclei-templates' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.x | |
- name: install checksum generator | |
run: | | |
go install -v github.com/projectdiscovery/nuclei/v2/cmd/generate-checksum@dev | |
- 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 "[email protected]" | |
git config --local user.name "GitHub Action" | |
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: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |