Skip to content

Commit a9bdb2f

Browse files
Minor code enhancements to use GITHUB_OUTPUT and to exit the run if the commit-hash validation fails (#1)
* Minor changes to use GITHUB_OUTPUT instead of the deprecated set-output
1 parent 575d526 commit a9bdb2f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

action.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ inputs:
1818
outputs:
1919
valid_commit:
2020
description: "Indicates if the commit hash is valid"
21+
value: ${{ steps.verify-commit.outputs.valid_commit }}
2122

2223
runs:
2324
using: "composite"
@@ -30,15 +31,15 @@ runs:
3031
commit_id="${{ inputs.commit-hash }}"
3132
3233
if ! git rev-parse --quiet --verify "${commit_id}"; then
33-
echo "::set-output name=valid_commit::false"
34+
echo "valid_commit=false" >> $GITHUB_OUTPUT
3435
echo "Invalid commit hash: \`$commit_id\`"
3536
else
3637
# Verify if the commit is on the specified branch
3738
if ! git merge-base --is-ancestor "${commit_id}" "${branch_name}"; then
38-
echo "::set-output name=valid_commit::false"
39-
echo "Commit \`$commit_id\` not found from branch \`$branch_name\`"
39+
echo "valid_commit=false" >> $GITHUB_OUTPUT
40+
echo "Commit \`$commit_id\` not found on the branch \`$branch_name\`"
4041
else
41-
echo "::set-output name=valid_commit::true"
42-
echo "Commit \`$commit_id\` is valid from branch \`$branch_name\`"
42+
echo "valid_commit=true" >> $GITHUB_OUTPUT
43+
echo "Commit \`$commit_id\` is valid on the branch \`$branch_name\`"
4344
fi
4445
fi

0 commit comments

Comments
 (0)