Skip to content

Commit

Permalink
Add version updater to
Browse files Browse the repository at this point in the history
  • Loading branch information
domwhewell-sage committed Jun 3, 2024
1 parent eeae1cb commit 2b422b7
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/version_updater.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Version Updater
on:
schedule:
- cron: '0 0 * * *'
manual_trigger:

jobs:
update-nuclei-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: stable
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Get latest version
id: get-latest-version
run: |
import os, requests
response = requests.get('https://api.github.com/repos/projectdiscovery/nuclei/releases/latest')
version = response.json()['tag_name'].lstrip('v')
os.system(f"echo 'latest_version={version}' >> $GITHUB_ENV")
shell: python
- name: Get current version
id: get-current-version
run: |
version=$(grep -m 1 -oP '(?<=version": ")[^"]*' bbot/modules/deadly/nuclei.py)
echo "current_version=$version" >> $GITHUB_ENV
- name: Update version
id: update-version
if: env.latest_version != env.current_version
run: "sed -i '0,/\"version\": \".*\",/ s/\"version\": \".*\",/\"version\": \"${{ env.latest_version }}\",/g' bbot/modules/deadly/nuclei.py"
- name: Create pull request to update the version
if: steps.update-version.outcome == 'success'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update nuclei"
title: "Update nuclei to ${{ env.latest_version }}"
body: "This PR uses https://api.github.com/repos/projectdiscovery/nuclei/releases/latest to obtain the latest version of nuclei and update the version in bbot/modules/deadly/nuclei.py."
branch: "update-nuclei"
committer: GitHub <[email protected]>
author: GitHub <[email protected]>
assignees: "TheTechromancer"
update-trufflehog-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: stable
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Get latest version
id: get-latest-version
run: |
import os, requests
response = requests.get('https://api.github.com/repos/trufflesecurity/trufflehog/releases/latest')
version = response.json()['tag_name'].lstrip('v')
os.system(f"echo 'latest_version={version}' >> $GITHUB_ENV")
shell: python
- name: Get current version
id: get-current-version
run: |
version=$(grep -m 1 -oP '(?<=version": ")[^"]*' bbot/modules/trufflehog.py)
echo "current_version=$version" >> $GITHUB_ENV
- name: Update version
id: update-version
if: env.latest_version != env.current_version
run: "sed -i '0,/\"version\": \".*\",/ s/\"version\": \".*\",/\"version\": \"${{ env.latest_version }}\",/g' bbot/modules/trufflehog.py"
- name: Create pull request to update the version
if: steps.update-version.outcome == 'success'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update trufflehog"
title: "Update trufflehog to ${{ env.latest_version }}"
body: "This PR uses https://api.github.com/repos/trufflesecurity/trufflehog/releases/latest to obtain the latest version of trufflehog and update the version in bbot/modules/trufflehog.py."
branch: "update-trufflehog"
committer: GitHub <[email protected]>
author: GitHub <[email protected]>
assignees: "TheTechromancer"

0 comments on commit 2b422b7

Please sign in to comment.