Skip to content

Commit 85d5e92

Browse files
Merge pull request #1425 from domwhewell-sage/version-updater
Add a version updater gihub action
2 parents 2901e26 + e285d7e commit 85d5e92

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed
+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Version Updater
2+
on:
3+
schedule:
4+
- cron: '0 0 * * *'
5+
6+
jobs:
7+
update-nuclei-version:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
with:
12+
fetch-depth: 0
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.x'
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install requests
21+
- name: Get latest version
22+
id: get-latest-version
23+
run: |
24+
import os, requests
25+
response = requests.get('https://api.github.com/repos/projectdiscovery/nuclei/releases/latest')
26+
version = response.json()['tag_name'].lstrip('v')
27+
os.system(f"echo 'latest_version={version}' >> $GITHUB_ENV")
28+
shell: python
29+
- name: Get current version
30+
id: get-current-version
31+
run: |
32+
version=$(grep -m 1 -oP '(?<=version": ")[^"]*' bbot/modules/deadly/nuclei.py)
33+
echo "current_version=$version" >> $GITHUB_ENV
34+
- name: Update version
35+
id: update-version
36+
if: env.latest_version != env.current_version
37+
run: sed -i '0,/\"version\": \".*\",/ s/\"version\": \".*\",/\"version\": \"${{ env.latest_version }}\",/g' bbot/modules/deadly/nuclei.py
38+
- name: Create pull request to update the version
39+
if: steps.update-version.outcome == 'success'
40+
uses: peter-evans/create-pull-request@v5
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
commit-message: "Update nuclei"
44+
title: "Update nuclei to ${{ env.latest_version }}"
45+
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."
46+
branch: "dev"
47+
committer: GitHub <[email protected]>
48+
author: GitHub <[email protected]>
49+
assignees: "TheTechromancer"
50+
update-trufflehog-version:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v2
54+
with:
55+
fetch-depth: 0
56+
- name: Set up Python
57+
uses: actions/setup-python@v4
58+
with:
59+
python-version: '3.x'
60+
- name: Install dependencies
61+
run: |
62+
python -m pip install --upgrade pip
63+
pip install requests
64+
- name: Get latest version
65+
id: get-latest-version
66+
run: |
67+
import os, requests
68+
response = requests.get('https://api.github.com/repos/trufflesecurity/trufflehog/releases/latest')
69+
version = response.json()['tag_name'].lstrip('v')
70+
os.system(f"echo 'latest_version={version}' >> $GITHUB_ENV")
71+
shell: python
72+
- name: Get current version
73+
id: get-current-version
74+
run: |
75+
version=$(grep -m 1 -oP '(?<=version": ")[^"]*' bbot/modules/trufflehog.py)
76+
echo "current_version=$version" >> $GITHUB_ENV
77+
- name: Update version
78+
id: update-version
79+
if: env.latest_version != env.current_version
80+
run: sed -i '0,/\"version\": \".*\",/ s/\"version\": \".*\",/\"version\": \"${{ env.latest_version }}\",/g' bbot/modules/trufflehog.py
81+
- name: Create pull request to update the version
82+
if: steps.update-version.outcome == 'success'
83+
uses: peter-evans/create-pull-request@v5
84+
with:
85+
token: ${{ secrets.GITHUB_TOKEN }}
86+
commit-message: "Update trufflehog"
87+
title: "Update trufflehog to ${{ env.latest_version }}"
88+
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."
89+
branch: "dev"
90+
committer: GitHub <[email protected]>
91+
author: GitHub <[email protected]>
92+
assignees: "TheTechromancer"

0 commit comments

Comments
 (0)