Skip to content

Commit

Permalink
Fix generate-prdoc for single audiences (paritytech#6103)
Browse files Browse the repository at this point in the history
`prdoc check -n NNNN` (used in CI) enforces that yaml lists only be used
for lists with length more than one.

Previously this script generated a list no matter how many audiences
were provided, which generated a broken PRDoc when that number was 1.

Reproducing the issue locally:
```
python .github/scripts/generate-prdoc.py --pr 6022 --bump patch --audience runtime_user --force
prdoc check -n 6022
```
Fails on master but passes with this change

Co-authored-by: Bastian Köcher <[email protected]>
  • Loading branch information
seadanda and bkchr authored Oct 17, 2024
1 parent 1cc760b commit d23a1bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/scripts/generate-prdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,16 @@ def setup_parser(parser=None, pr_required=True):
return parser

def snake_to_title(s):
return ' '.join(word.capitalize() for word in s.split('_'))
return ' '.join(word.capitalize() for word in s.split('_'))

def main(args):
print(f"Args: {args}, force: {args.force}")
setup_yaml()
try:
# Convert snake_case audience arguments to title case
mapped_audiences = [snake_to_title(a) for a in args.audience]
if len(mapped_audiences) == 1:
mapped_audiences = mapped_audiences[0]
from_pr_number(args.pr, mapped_audiences, args.bump, args.force)
return 0
except Exception as e:
Expand Down

0 comments on commit d23a1bb

Please sign in to comment.