diff --git a/.github/workflows/templates-stats.yml b/.github/workflows/templates-stats.yml new file mode 100644 index 0000000000..76979791ea --- /dev/null +++ b/.github/workflows/templates-stats.yml @@ -0,0 +1,57 @@ +name: Templates Stats + +on: + create: + tags: + - v* + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@master + + - name: Setup golang + uses: actions/setup-go@v2 + with: + go-version: 1.14 + + - name: Cache Go + id: cache-go + uses: actions/cache@v2 + with: + path: /home/runner/go + key: ${{ runner.os }}-go + + - name: Installing Template Stats + if: steps.cache-go.outputs.cache-hit != 'true' + env: + GO111MODULE: on + run: | + go get -v github.com/projectdiscovery/templates-stats + shell: bash + + - name: Markdown Stats + run: | + templates-stats -output TEMPLATES-STATS.md -path . + shell: bash + + - name: JSON Stats + run: | + templates-stats -output TEMPLATES-STATS.json -json -path . + shell: bash + + - name: Commit files + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -m "Auto Generated Templates Stats [$(date)] :robot:" -a + + - name: Push changes + if: steps.update-readme.outputs.changes > 0 + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} \ No newline at end of file