Skip to content

Commit 522f863

Browse files
committed
ci: list advisories that have been changed in pr body
1 parent 6e1395d commit 522f863

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

.github/workflows/generate.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ jobs:
3232
- run: poetry run scripts/precache_nodes.py
3333
- run: rm -rf advisories/
3434
- run: poetry run scripts/generate_osv_advisories.py
35+
- run: |
36+
echo "🤖 beep boop - looks like there's some changes to the advisories!" > pr-body
37+
echo "" >> pr-body
38+
poetry run scripts/list_changed_advisories.py >> pr-body
3539
- uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
3640
with:
3741
token: ${{ secrets.GENERATOR_GH_TOKEN }}
3842
title: 'feat: update advisories'
39-
body: >
40-
🤖 beep boop - looks like there's some changes to the advisories!
43+
body-path: pr-body
4144
branch: 'bot/update-advisories'
4245
author: |
4346
github-actions <41898282+github-actions[bot]@users.noreply.github.com>

scripts/list_changed_advisories.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Lists links to the advisories that have been changed according to git
5+
"""
6+
7+
import re
8+
import subprocess
9+
10+
output = subprocess.check_output(['git', 'status', '--porcelain'], text=True)
11+
12+
for line in output.split('\n'):
13+
match = re.match(r'.. advisories/\w+/(DRUPAL-.*)', line)
14+
if match:
15+
sa = match[1].replace('DRUPAL-', 'SA-').removesuffix('.json')
16+
print(f'- https://www.drupal.org/{sa}')

0 commit comments

Comments
 (0)