Skip to content

Commit

Permalink
Merge pull request #57 from reviewdog/set-output-is-deprecated
Browse files Browse the repository at this point in the history
migrate set-output command to environment files
  • Loading branch information
shogo82148 authored Nov 20, 2022
2 parents 3be33e4 + 7eb43fb commit fa07ba5
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ list_versions() {
fi
}

set_output() {
name=$1
value=$2
if [ -n "${GITHUB_OUTPUT}" ]; then
echo "$name=$value" >> "${GITHUB_OUTPUT}"
else
echo "::set-output name=$name::$value"
fi
}

LATEST_VERSION="$(\
list_versions | \
grep -oP '\d+(\.\d+)+(-[^'\''\"\s]*)?$'| \
Expand All @@ -51,9 +61,9 @@ fi
echo "Latest ${VERSION_NAME}=${LATEST_VERSION}"

# Set outputs.
echo "::set-output name=current::${CURRENT_VERSION}"
echo "::set-output name=latest::${LATEST_VERSION}"
echo "::set-output name=repo::${REPO}"
set_output "current" "${CURRENT_VERSION}"
set_output "latest" "${LATEST_VERSION}"
set_output "repo" "${REPO}"

if [ "${CURRENT_VERSION}" = "${LATEST_VERSION}" ]; then
echo "${VERSION_NAME} is latest. Nothing to do."
Expand Down

0 comments on commit fa07ba5

Please sign in to comment.