Skip to content

Commit 762c874

Browse files
authored
fix(action.yml): shorten git_commit_hash to 7 characters (#243)
The builder uses `git log --pretty=format:'%h' -n 1`. The `%h` placeholder in Git's pretty format outputs the abbreviated commit hash. By default, [Git determines the abbreviation length dynamically for the repository](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreabbrev​), defaulting/minimum of 7 characters. To maintain a consistent abbrv length (e.g., 7 characters), we can explicitly set the length in our command. `git log --pretty=format:'%h' -n 1 --abbrev=7`
1 parent 2fa117a commit 762c874

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

.github/actions/deploy/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ runs:
7676
shell: bash
7777
run: |
7878
cd source
79-
echo "git_commit_hash=$(echo $(git log --pretty=format:'%h' -n 1))" >> $GITHUB_OUTPUT
79+
echo "git_commit_hash=$(echo $(git log --pretty=format:'%h' -n 1 --abbrev=7))" >> $GITHUB_OUTPUT
8080
- name: get full git commit hash
8181
id: git_commit_hash_full
8282
shell: bash

0 commit comments

Comments
 (0)