🌥 Sync queries from Public Templates #3
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: 🌥 Sync queries from Public Templates | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 */6 * * *' # Runs every 6 hours | |
jobs: | |
sync-repositories: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Clone nuclei-templates Repository | |
run: git clone https://${{ secrets.GTOKEN }}:[email protected]/projectdiscovery/nuclei-templates | |
- name: Clone awesome-search-queries Repository | |
env: | |
GTOKEN: ${{ secrets.GTOKEN }} | |
run: git clone https://${{ secrets.GTOKEN }}:[email protected]/projectdiscovery/awesome-search-queries | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install Python Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install ruamel.yaml | |
- name: Run mapqueries.py Script | |
run: | | |
cd awesome-search-queries/.github/scripts | |
python mapqueries.py -tdir ${{ github.workspace }}/nuclei-templates -out ${{ github.workspace }}/awesome-search-queries/QUERIES.yaml -ignore ${{ github.workspace }}/awesome-search-queries/.ignore | |
- name: Commit and Push Changes to awesome-search-queries | |
env: | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_AUTHOR_NAME: '[PDBot]' | |
GIT_COMMITTER_EMAIL: [email protected] | |
GIT_COMMITTER_NAME: '[PDBot]' | |
GIT_TERMINAL_PROMPT: "0" | |
run: | | |
cd awesome-search-queries | |
git config user.name '[PDBot]' | |
git config user.email '[email protected]' | |
git add QUERIES.yaml | |
if [ -z "$(git status --porcelain)" ]; then | |
echo "No changes to commit in awesome-search-queries" | |
exit 0 | |
fi | |
git commit -m "Syncing queries from Templates" | |
git push https://${{ secrets.GTOKEN }}:[email protected]/projectdiscovery/awesome-search-queries.git || { | |
for i in {1..10}; do | |
git pull --rebase | |
git push https://${{ secrets.GTOKEN }}:[email protected]/projectdiscovery/awesome-search-queries.git && break | |
echo "Retry $i" | |
done | |
} |