Skip to content

Commit 0bb0481

Browse files
committed
Provide commit message in workflow as action input (BLD-5704)
1 parent ac88fed commit 0bb0481

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

Diff for: .github/workflows/status_check.yml

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ jobs:
1515
with:
1616
python-version: "3.7"
1717
- uses: ccdc-opensource/commit-hooks@jira_bld_5704_jira_id_in_commit_message
18+
with:
19+
commit-message: ${{ github.event.head_commit.message }}

Diff for: action.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ description: Check changed files for compliance
44
runs:
55
using: "composite"
66
steps:
7-
- run: python3 $GITHUB_ACTION_PATH/main.py ${{ github.event.head_commit.message }}
7+
- run: python3 $GITHUB_ACTION_PATH/main.py
88
shell: bash
9+
inputs:
10+
commit-message:
11+
description: 'The commit message, ie. ${{ github.event.head_commit.message }}'
12+
required: true
913
branding:
1014
icon: 'check-square'
1115
color: 'green'

Diff for: main.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
'''
88

9+
import os
910
from pathlib import Path
1011
import sys
1112

@@ -14,7 +15,11 @@
1415

1516
if __name__ == '__main__':
1617

17-
message = sys.argv[1]
18+
for k,v in os.environ.items():
19+
if k.startswith('INPUT_'):
20+
print(k, v)
21+
22+
message = ''
1823
print(f'Commit message: {message}')
1924

2025
print(f'Checking commit {githooks.get_sha()} by {githooks.get_user()} in {githooks.get_branch()}')

0 commit comments

Comments
 (0)