Skip to content

Commit

Permalink
Remove deprecated set-output command (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoninbas authored Feb 20, 2023
1 parent 9aac387 commit f1e57eb
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

source $THIS_DIR/check_changes.sh

set_output() {
result="$1"
echo "Setting 'has_changes' to '$result'"
echo "has_changes=$result" >> $GITHUB_OUTPUT
}

# See https://github.com/actions/checkout/issues/760
echo "Adding repository directory to the git global config as a safe directory"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
Expand All @@ -39,8 +45,7 @@ elif [[ $BEFORE != "" && $BEFORE != "null" ]]; then # push events
SHA=$BEFORE
else
echo "This does not appear to be a PR or a push event"
echo "Setting 'has_changes' to 'yes'"
echo "::set-output name=has_changes::yes"
set_output "yes"
exit 0
fi
echo "BASE SHA: $SHA"
Expand All @@ -50,17 +55,14 @@ CHANGED_FILES=$(git diff --name-only "$SHA" HEAD) || rc=$?
if [[ $rc -ne 0 ]]; then
echo "Error when running 'git diff'"
echo "This is expected when the repo was not checked-out properly, or after a force push"
echo "Setting 'has_changes' to 'yes'"
echo "::set-output name=has_changes::yes"
set_output "yes"
exit 0
fi

has_changes=$(check_changes "$CHANGED_FILES" "${PATTERNS[*]}" "${IGNORE_PATTERNS[*]}")

if $has_changes; then
echo "Setting 'has_changes' to 'yes'"
echo "::set-output name=has_changes::yes"
set_output "yes"
else
echo "Setting 'has_changes' to 'no'"
echo "::set-output name=has_changes::no"
set_output "no"
fi

0 comments on commit f1e57eb

Please sign in to comment.