Skip to content

Commit

Permalink
common/Hooks: Add support for 'Add at' and '[NFC]' commits
Browse files Browse the repository at this point in the history
**Summary**
- Add at for initial package inclusion
- Non functional change when the package isn't rebuilt
  • Loading branch information
joebonrichie committed Oct 9, 2024
1 parent 248e1f6 commit 655ada6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions common/Hooks/prepare-commit-msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,16 @@ def commit_scope(commit_dir: str) -> str:
stdout=subprocess.PIPE)
if "+version" in recipe_diff_result.stdout.decode('utf-8'):
with open(os.path.join(commit_dir, 'package.yml')) as recipe:
version = yaml.safe_load(recipe)['version']
return os.path.basename(commit_dir) + ': Update to ' + str(version)
data = yaml.safe_load(recipe)
if str(data['release']) == '1':
return os.path.basename(commit_dir) + ': Add at ' + str(data['version'])
return os.path.basename(commit_dir) + ': Update to ' + str(data['version'])

# Detect non-functional changes ([NFC])
staged_files_result = subprocess.run(['git', 'diff', '--name-only', '--staged', commit_dir],
stdout=subprocess.PIPE)
if 'pspec_x86_64.xml' not in staged_files_result.stdout.decode('utf-8'):
return "[NFC] " + os.path.basename(commit_dir) + ': '

return os.path.basename(commit_dir) + ': '

Expand Down

0 comments on commit 655ada6

Please sign in to comment.