Skip to content

Commit 7f625f9

Browse files
authored
Update action to output commit SHA (#122)
1 parent 27e0ba6 commit 7f625f9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

actions/commit_pr_and_merge/action.yaml

+8-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ inputs:
1515
outputs:
1616
git_tag_or_hash:
1717
description: The git tag (or hash if no tag provided) of the merge commit
18-
value: ${{ steps.tag-commit.outcome == 'success' && steps.tag-commit.outputs.commit_tag || steps.get-commit-hash.outputs.commit_sha }}
18+
value: ${{ steps.tag-commit.outcome == 'success' && steps.tag-commit.outputs.commit_tag || steps.get-commit-sha.outputs.commit_sha }}
19+
commit_sha:
20+
description: The git hash of the merge commit
21+
value: ${{ steps.get-commit-sha.outputs.commit_sha }}
1922

2023
runs:
2124
using: "composite"
@@ -75,10 +78,9 @@ runs:
7578
});
7679
core.setOutput('commit_tag', '${{ inputs.tag }}');
7780
78-
- name: Get commit hash
81+
- name: Get commit SHA
7982
uses: actions/github-script@v7
80-
id: get-commit-hash
81-
if: ${{ ! inputs.tag }}
83+
id: get-commit-sha
8284
with:
8385
script: |
8486
const pr = (await github.rest.pulls.get({
@@ -95,4 +97,5 @@ runs:
9597
with:
9698
script: |
9799
console.log('Result', '${{ steps.tag-commit.outcome }}');
98-
console.log('Commit tag', '${{ steps.tag-commit.outputs.commit_tag }}');
100+
console.log('Commit tag', '${{ steps.tag-commit.outputs.commit_tag }}');
101+
console.log('Commit sha', '${{ steps.get-commit-sha.outputs.commit_sha }}');

0 commit comments

Comments
 (0)