-
Notifications
You must be signed in to change notification settings - Fork 561
112 lines (109 loc) · 4.63 KB
/
version_updater.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Version Updater
on:
schedule:
# Runs at 00:00 every day
- cron: '0 0 * * *'
workflow_dispatch: # Adds the ability to manually trigger the workflow
jobs:
update-nuclei-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: dev
fetch-depth: 0
token: ${{ secrets.BBOT_DOCS_UPDATER_PAT }}
- 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')
release_notes = response.json()['body']
with open(os.getenv('GITHUB_ENV'), 'a') as env_file:
env_file.write(f"latest_version={version}\n")
env_file.write(f"release_notes<<EOF\n{release_notes}\nEOF\n")
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.BBOT_DOCS_UPDATER_PAT }}
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."
# Release notes:
${{ env.release_notes }}
branch: "update-nuclei"
committer: blsaccess <info@blacklanternsecurity.com>
author: blsaccess <info@blacklanternsecurity.com>
assignees: "TheTechromancer"
update-trufflehog-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: dev
fetch-depth: 0
token: ${{ secrets.BBOT_DOCS_UPDATER_PAT }}
- 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')
release_notes = response.json()['body']
with open(os.getenv('GITHUB_ENV'), 'a') as env_file:
env_file.write(f"latest_version={version}\n")
env_file.write(f"release_notes<<EOF\n{release_notes}\nEOF\n")
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.BBOT_DOCS_UPDATER_PAT }}
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.
# Release notes:
${{ env.release_notes }}
branch: "update-trufflehog"
committer: blsaccess <info@blacklanternsecurity.com>
author: blsaccess <info@blacklanternsecurity.com>
assignees: "TheTechromancer"